diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..a5d6bf1 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..491deae --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: pip + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0190fd7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +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 (python ${{ matrix.python }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ['3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Import the installed package + # `--with .` installs this package into a throwaway environment, so this exercises the + # path a user takes and proves the dependency list in pyproject.toml is complete. Run + # from RUNNER_TEMP, or the import would resolve to the source directory instead of what + # was installed. + run: cd "$RUNNER_TEMP" && uv run --no-project --python ${{ matrix.python }} --with "$GITHUB_WORKSPACE" python -c "import flat_api; print(flat_api.__version__)" + - name: Compile every module + run: uv run --no-project --python ${{ matrix.python }} python -m compileall -q flat_api diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..80cbc1c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,90 @@ +name: Release + +# Publishing is triggered by a version tag and nothing else (FR-019a). The tag is created by +# tag-on-merge.yml, so the approval -> merge -> tag -> publish ordering is enforced by the +# platform rather than by convention (FR-007f). + +on: + push: + tags: ['v[0-9]+.[0-9]+.[0-9]+'] + +permissions: + contents: write # create the GitHub release for the tag + id-token: write # OIDC for PyPI trusted publishing and provenance (FR-021a, FR-021b) + +jobs: + publish: + runs-on: ubuntu-latest + environment: pypi + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: '3.12' + + - 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; } + + - run: uv build + + # Assert the artifact, not just the file. setuptools derives the version from VERSION, but a + # broken pyproject.toml still builds: it silently produced flat_api-0.0.0 once. PyPI never + # lets a version be replaced, so this has to fail here rather than after the upload. + - name: The built artifact must carry the tagged 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}" + test -f "dist/flat_api-${TAG}-py3-none-any.whl" || { + echo "no wheel for ${TAG}; dist/ holds:"; ls dist/; exit 1; + } + test -f "dist/flat_api-${TAG}.tar.gz" || { + echo "no sdist for ${TAG}; dist/ holds:"; ls dist/; exit 1; + } + + # No long-lived token exists: PyPI trusts this repository and workflow by OIDC. + - name: Skip the publish if this version is already on PyPI + id: published + run: | + VERSION="${GITHUB_REF_NAME#v}" + if curl -fsS "https://pypi.org/pypi/flat-api/$VERSION/json" >/dev/null 2>&1; then + echo "flat-api $VERSION is already on PyPI; nothing to publish." + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + + - name: Publish to PyPI (trusted publishing) + if: steps.published.outputs.skip != 'true' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true + + # A bare tag tells a reader nothing. This gives the version a page carrying its changelog + # section, and it is what a watcher of this repository is notified about. + - name: Publish the GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + # The release is named for the tag. The version inside the package never carries the v, + # so the changelog lookup and the install line use it stripped. + 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." + printf '%s\n\n---\n\nInstall: `pip install flat-api==%s`\n' "$NOTES" "$VERSION" > /tmp/notes.md + # 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-file /tmp/notes.md --verify-tag + fi diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml new file mode 100644 index 0000000..f1bc04e --- /dev/null +++ b/.github/workflows/tag-on-merge.yml @@ -0,0 +1,49 @@ +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. + # Checked before checkout. An empty token there surfaces as a bare "Input required and not + # supplied: token", which says nothing about which secret is missing or why it matters. + - name: SDK_RELEASE_TOKEN must be set + run: | + test -n "${{ secrets.SDK_RELEASE_TOKEN }}" || { + echo "SDK_RELEASE_TOKEN is not set on this repository." + echo + echo "The tag has to be pushed with it rather than the automatic GITHUB_TOKEN, because" + echo "GitHub does not start a workflow run for an event created with that token. The" + echo "tag would appear and release.yml would never fire, publishing nothing." + exit 1 + } + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.SDK_RELEASE_TOKEN }} + - name: Tag the version if it is new + run: | + # 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 2fba2c4..4a3c87e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,11 @@ dist/ downloads/ eggs/ .eggs/ -lib/ -lib64/ +# Anchored. Unanchored, these match at any depth, and lib/ matched tools/lib/, which is why +# tools/lib/generate-common.sh was never committed and tools/generate.sh could not run from a +# clone of this repository. +/lib/ +/lib64/ parts/ sdist/ var/ @@ -65,3 +68,12 @@ target/ # Virtualenv .venv + +# generation scratch tree (tools/generate.sh) +.sdkgen-scratch/ +.openapi-spec.yaml + +# build and tooling artifacts +.venv/ +.pytest_cache/ +.coverage diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..de7090f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=flat_api + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine 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..e808f57 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,629 @@ +.openapi-generator-ignore +flat_api/__init__.py +flat_api/api/__init__.py +flat_api/api/account_api.py +flat_api/api/class_api.py +flat_api/api/collection_api.py +flat_api/api/edu_resources_api.py +flat_api/api/group_api.py +flat_api/api/omr_api.py +flat_api/api/organization_api.py +flat_api/api/score_api.py +flat_api/api/task_api.py +flat_api/api/user_api.py +flat_api/api_client.py +flat_api/api_response.py +flat_api/configuration.py +flat_api/docs/AccountApi.md +flat_api/docs/AddGroupUser200Response.md +flat_api/docs/AddGroupUserRequest.md +flat_api/docs/ApiAccessToken.md +flat_api/docs/AppScopes.md +flat_api/docs/Assignment.md +flat_api/docs/AssignmentCapabilities.md +flat_api/docs/AssignmentCapabilitiesCanPublishInClassError.md +flat_api/docs/AssignmentCopy.md +flat_api/docs/AssignmentCopyResponse.md +flat_api/docs/AssignmentCopyToClass.md +flat_api/docs/AssignmentCopyToResourceLibrary.md +flat_api/docs/AssignmentGroup.md +flat_api/docs/AssignmentSubmission.md +flat_api/docs/AssignmentSubmissionComment.md +flat_api/docs/AssignmentSubmissionCommentCreation.md +flat_api/docs/AssignmentSubmissionComments.md +flat_api/docs/AssignmentSubmissionHistory.md +flat_api/docs/AssignmentSubmissionHistoryAttachment.md +flat_api/docs/AssignmentSubmissionHistoryState.md +flat_api/docs/AssignmentSubmissionLti.md +flat_api/docs/AssignmentSubmissionPlayback.md +flat_api/docs/AssignmentSubmissionState.md +flat_api/docs/AssignmentSubmissionStudentsMode.md +flat_api/docs/AssignmentSubmissionUpdate.md +flat_api/docs/AssignmentType.md +flat_api/docs/AssignmentUpdate.md +flat_api/docs/ClassApi.md +flat_api/docs/ClassAssignment.md +flat_api/docs/ClassAssignmentAllOfCanvas.md +flat_api/docs/ClassAssignmentAllOfLti.md +flat_api/docs/ClassAssignmentAllOfMfc.md +flat_api/docs/ClassAssignmentUpdate.md +flat_api/docs/ClassAssignmentUpdateAllOfGoogleClassroom.md +flat_api/docs/ClassAssignmentUpdateAllOfMicrosoftGraph.md +flat_api/docs/ClassAttachmentCreation.md +flat_api/docs/ClassCreation.md +flat_api/docs/ClassDetails.md +flat_api/docs/ClassDetailsCanvas.md +flat_api/docs/ClassDetailsClever.md +flat_api/docs/ClassDetailsGoogleClassroom.md +flat_api/docs/ClassDetailsGoogleDrive.md +flat_api/docs/ClassDetailsIssues.md +flat_api/docs/ClassDetailsIssuesSyncInner.md +flat_api/docs/ClassDetailsLti.md +flat_api/docs/ClassDetailsMfc.md +flat_api/docs/ClassDetailsMicrosoftGraph.md +flat_api/docs/ClassGradeLevel.md +flat_api/docs/ClassRoles.md +flat_api/docs/ClassState.md +flat_api/docs/ClassUpdate.md +flat_api/docs/Collection.md +flat_api/docs/CollectionApi.md +flat_api/docs/CollectionApp.md +flat_api/docs/CollectionCapabilities.md +flat_api/docs/CollectionContents.md +flat_api/docs/CollectionCreation.md +flat_api/docs/CollectionModification.md +flat_api/docs/CollectionPrivacy.md +flat_api/docs/CollectionType.md +flat_api/docs/CreditTransaction.md +flat_api/docs/EduLibrary.md +flat_api/docs/EduResource.md +flat_api/docs/EduResourceAssignmentCreation.md +flat_api/docs/EduResourceCapabilities.md +flat_api/docs/EduResourceCopy.md +flat_api/docs/EduResourceCreation.md +flat_api/docs/EduResourceFolder.md +flat_api/docs/EduResourceLtiLink.md +flat_api/docs/EduResourceMove.md +flat_api/docs/EduResourcePrivacy.md +flat_api/docs/EduResourceResource.md +flat_api/docs/EduResourceType.md +flat_api/docs/EduResourceUpdate.md +flat_api/docs/EduResourceUseInClass.md +flat_api/docs/EduResourcesApi.md +flat_api/docs/FlatErrorResponse.md +flat_api/docs/GoogleClassroomCoursework.md +flat_api/docs/GoogleClassroomSubmission.md +flat_api/docs/Grade.md +flat_api/docs/Group.md +flat_api/docs/GroupApi.md +flat_api/docs/GroupCreation.md +flat_api/docs/GroupDetails.md +flat_api/docs/GroupType.md +flat_api/docs/LicenseMode.md +flat_api/docs/LicenseSources.md +flat_api/docs/LmsName.md +flat_api/docs/LtiConfiguration.md +flat_api/docs/LtiConfiguration1p1.md +flat_api/docs/LtiConfiguration1p1AllOfTool.md +flat_api/docs/LtiConfiguration1p3.md +flat_api/docs/LtiConfiguration1p3Base.md +flat_api/docs/LtiConfiguration1p3BaseSupportedServices.md +flat_api/docs/LtiConfiguration1p3BaseSupportedServicesAgs.md +flat_api/docs/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md +flat_api/docs/LtiConfiguration1p3BaseSupportedServicesNrps.md +flat_api/docs/LtiConfiguration1p3BaseTool.md +flat_api/docs/LtiConfiguration1p3Deployment.md +flat_api/docs/LtiConfiguration1p3Dynamic.md +flat_api/docs/LtiConfiguration1p3Manual.md +flat_api/docs/LtiConfigurationBase.md +flat_api/docs/LtiConfigurationCreate.md +flat_api/docs/LtiConfigurationCreate1p1.md +flat_api/docs/LtiConfigurationCreate1p3Deployment.md +flat_api/docs/LtiConfigurationCreate1p3Dynamic.md +flat_api/docs/LtiConfigurationCreate1p3DynamicPlatformInfo.md +flat_api/docs/LtiConfigurationCreate1p3Manual.md +flat_api/docs/LtiConfigurationUpdate.md +flat_api/docs/LtiConfigurationUpdateDeployment.md +flat_api/docs/LtiConfigurationUpdateStandalone.md +flat_api/docs/LtiCredentials.md +flat_api/docs/LtiCredentialsCreation.md +flat_api/docs/MediaAttachment.md +flat_api/docs/MediaScoreSharingMode.md +flat_api/docs/MicrosoftGraphAssignment.md +flat_api/docs/MicrosoftGraphSubmission.md +flat_api/docs/OMRApi.md +flat_api/docs/OmrCapabilities.md +flat_api/docs/OmrDetailsStepData.md +flat_api/docs/OmrDetailsSubmission.md +flat_api/docs/OmrDetectedInstrument.md +flat_api/docs/OmrImportedMetadata.md +flat_api/docs/OmrInstrumentOverride.md +flat_api/docs/OmrJob.md +flat_api/docs/OmrJobCreation.md +flat_api/docs/OmrJobFileMetadata.md +flat_api/docs/OmrJobFileUpload.md +flat_api/docs/OmrJobFileUploadResult.md +flat_api/docs/OmrJobInputFile.md +flat_api/docs/OmrJobOutput.md +flat_api/docs/OmrJobProgress.md +flat_api/docs/OmrJobResult.md +flat_api/docs/OmrJobRetention.md +flat_api/docs/OmrJobStatus.md +flat_api/docs/OmrLocaleDetails.md +flat_api/docs/OmrPendingStep.md +flat_api/docs/OmrStepName.md +flat_api/docs/OrganizationApi.md +flat_api/docs/OrganizationInvitation.md +flat_api/docs/OrganizationInvitationCreation.md +flat_api/docs/OrganizationRoles.md +flat_api/docs/OrganizationUserAccessTokenCreation.md +flat_api/docs/RenameGroupRequest.md +flat_api/docs/ResourceCollaborator.md +flat_api/docs/ResourceCollaboratorCreation.md +flat_api/docs/ResourceRights.md +flat_api/docs/ScoreApi.md +flat_api/docs/ScoreComment.md +flat_api/docs/ScoreCommentContext.md +flat_api/docs/ScoreCommentCreation.md +flat_api/docs/ScoreCommentModeration.md +flat_api/docs/ScoreCommentUpdate.md +flat_api/docs/ScoreCommentsCounts.md +flat_api/docs/ScoreCreation.md +flat_api/docs/ScoreCreationBuilderData.md +flat_api/docs/ScoreCreationBuilderDataAllOfBuilderData.md +flat_api/docs/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md +flat_api/docs/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md +flat_api/docs/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md +flat_api/docs/ScoreCreationCommon.md +flat_api/docs/ScoreCreationFileImport.md +flat_api/docs/ScoreCreationGoogleDriveImport.md +flat_api/docs/ScoreCreationType.md +flat_api/docs/ScoreDetails.md +flat_api/docs/ScoreDetailsAllOfMe.md +flat_api/docs/ScoreFork.md +flat_api/docs/ScoreLicense.md +flat_api/docs/ScoreLikesCounts.md +flat_api/docs/ScoreModification.md +flat_api/docs/ScorePlaysCounts.md +flat_api/docs/ScorePrivacy.md +flat_api/docs/ScoreRevision.md +flat_api/docs/ScoreRevisionCreation.md +flat_api/docs/ScoreRevisionStatistics.md +flat_api/docs/ScoreSource.md +flat_api/docs/ScoreSummary.md +flat_api/docs/ScoreTrack.md +flat_api/docs/ScoreTrackCreation.md +flat_api/docs/ScoreTrackCreationResponse.md +flat_api/docs/ScoreTrackPoint.md +flat_api/docs/ScoreTrackPurpose.md +flat_api/docs/ScoreTrackState.md +flat_api/docs/ScoreTrackType.md +flat_api/docs/ScoreTrackUpdate.md +flat_api/docs/ScoreViewsCounts.md +flat_api/docs/Task.md +flat_api/docs/TaskApi.md +flat_api/docs/TaskExportOptions.md +flat_api/docs/TaskProgress.md +flat_api/docs/TaskResult.md +flat_api/docs/TeachingTheme.md +flat_api/docs/TutteoProduct.md +flat_api/docs/UserAdminUpdate.md +flat_api/docs/UserApi.md +flat_api/docs/UserAzureDetails.md +flat_api/docs/UserBasics.md +flat_api/docs/UserCommunityProfileLinks.md +flat_api/docs/UserCreation.md +flat_api/docs/UserDetails.md +flat_api/docs/UserDetailsAdmin.md +flat_api/docs/UserDetailsAdminAllOfLicense.md +flat_api/docs/UserPublic.md +flat_api/docs/UserPublicSummary.md +flat_api/docs/UserSigninLink.md +flat_api/docs/UserSigninLinkCreation.md +flat_api/exceptions.py +flat_api/models/__init__.py +flat_api/models/add_group_user200_response.py +flat_api/models/add_group_user_request.py +flat_api/models/api_access_token.py +flat_api/models/app_scopes.py +flat_api/models/assignment.py +flat_api/models/assignment_capabilities.py +flat_api/models/assignment_capabilities_can_publish_in_class_error.py +flat_api/models/assignment_copy.py +flat_api/models/assignment_copy_response.py +flat_api/models/assignment_copy_to_class.py +flat_api/models/assignment_copy_to_resource_library.py +flat_api/models/assignment_group.py +flat_api/models/assignment_submission.py +flat_api/models/assignment_submission_comment.py +flat_api/models/assignment_submission_comment_creation.py +flat_api/models/assignment_submission_comments.py +flat_api/models/assignment_submission_history.py +flat_api/models/assignment_submission_history_attachment.py +flat_api/models/assignment_submission_history_state.py +flat_api/models/assignment_submission_lti.py +flat_api/models/assignment_submission_playback.py +flat_api/models/assignment_submission_state.py +flat_api/models/assignment_submission_students_mode.py +flat_api/models/assignment_submission_update.py +flat_api/models/assignment_type.py +flat_api/models/assignment_update.py +flat_api/models/class_assignment.py +flat_api/models/class_assignment_all_of_canvas.py +flat_api/models/class_assignment_all_of_lti.py +flat_api/models/class_assignment_all_of_mfc.py +flat_api/models/class_assignment_update.py +flat_api/models/class_assignment_update_all_of_google_classroom.py +flat_api/models/class_assignment_update_all_of_microsoft_graph.py +flat_api/models/class_attachment_creation.py +flat_api/models/class_creation.py +flat_api/models/class_details.py +flat_api/models/class_details_canvas.py +flat_api/models/class_details_clever.py +flat_api/models/class_details_google_classroom.py +flat_api/models/class_details_google_drive.py +flat_api/models/class_details_issues.py +flat_api/models/class_details_issues_sync_inner.py +flat_api/models/class_details_lti.py +flat_api/models/class_details_mfc.py +flat_api/models/class_details_microsoft_graph.py +flat_api/models/class_grade_level.py +flat_api/models/class_roles.py +flat_api/models/class_state.py +flat_api/models/class_update.py +flat_api/models/collection.py +flat_api/models/collection_app.py +flat_api/models/collection_capabilities.py +flat_api/models/collection_contents.py +flat_api/models/collection_creation.py +flat_api/models/collection_modification.py +flat_api/models/collection_privacy.py +flat_api/models/collection_type.py +flat_api/models/credit_transaction.py +flat_api/models/edu_library.py +flat_api/models/edu_resource.py +flat_api/models/edu_resource_assignment_creation.py +flat_api/models/edu_resource_capabilities.py +flat_api/models/edu_resource_copy.py +flat_api/models/edu_resource_creation.py +flat_api/models/edu_resource_folder.py +flat_api/models/edu_resource_lti_link.py +flat_api/models/edu_resource_move.py +flat_api/models/edu_resource_privacy.py +flat_api/models/edu_resource_resource.py +flat_api/models/edu_resource_type.py +flat_api/models/edu_resource_update.py +flat_api/models/edu_resource_use_in_class.py +flat_api/models/flat_error_response.py +flat_api/models/google_classroom_coursework.py +flat_api/models/google_classroom_submission.py +flat_api/models/grade.py +flat_api/models/group.py +flat_api/models/group_creation.py +flat_api/models/group_details.py +flat_api/models/group_type.py +flat_api/models/license_mode.py +flat_api/models/license_sources.py +flat_api/models/lms_name.py +flat_api/models/lti_configuration.py +flat_api/models/lti_configuration1p1.py +flat_api/models/lti_configuration1p1_all_of_tool.py +flat_api/models/lti_configuration1p3.py +flat_api/models/lti_configuration1p3_base.py +flat_api/models/lti_configuration1p3_base_supported_services.py +flat_api/models/lti_configuration1p3_base_supported_services_ags.py +flat_api/models/lti_configuration1p3_base_supported_services_deep_linking.py +flat_api/models/lti_configuration1p3_base_supported_services_nrps.py +flat_api/models/lti_configuration1p3_base_tool.py +flat_api/models/lti_configuration1p3_deployment.py +flat_api/models/lti_configuration1p3_dynamic.py +flat_api/models/lti_configuration1p3_manual.py +flat_api/models/lti_configuration_base.py +flat_api/models/lti_configuration_create.py +flat_api/models/lti_configuration_create1p1.py +flat_api/models/lti_configuration_create1p3_deployment.py +flat_api/models/lti_configuration_create1p3_dynamic.py +flat_api/models/lti_configuration_create1p3_dynamic_platform_info.py +flat_api/models/lti_configuration_create1p3_manual.py +flat_api/models/lti_configuration_update.py +flat_api/models/lti_configuration_update_deployment.py +flat_api/models/lti_configuration_update_standalone.py +flat_api/models/lti_credentials.py +flat_api/models/lti_credentials_creation.py +flat_api/models/media_attachment.py +flat_api/models/media_score_sharing_mode.py +flat_api/models/microsoft_graph_assignment.py +flat_api/models/microsoft_graph_submission.py +flat_api/models/omr_capabilities.py +flat_api/models/omr_details_step_data.py +flat_api/models/omr_details_submission.py +flat_api/models/omr_detected_instrument.py +flat_api/models/omr_imported_metadata.py +flat_api/models/omr_instrument_override.py +flat_api/models/omr_job.py +flat_api/models/omr_job_creation.py +flat_api/models/omr_job_file_metadata.py +flat_api/models/omr_job_file_upload.py +flat_api/models/omr_job_file_upload_result.py +flat_api/models/omr_job_input_file.py +flat_api/models/omr_job_output.py +flat_api/models/omr_job_progress.py +flat_api/models/omr_job_result.py +flat_api/models/omr_job_retention.py +flat_api/models/omr_job_status.py +flat_api/models/omr_locale_details.py +flat_api/models/omr_pending_step.py +flat_api/models/omr_step_name.py +flat_api/models/organization_invitation.py +flat_api/models/organization_invitation_creation.py +flat_api/models/organization_roles.py +flat_api/models/organization_user_access_token_creation.py +flat_api/models/rename_group_request.py +flat_api/models/resource_collaborator.py +flat_api/models/resource_collaborator_creation.py +flat_api/models/resource_rights.py +flat_api/models/score_comment.py +flat_api/models/score_comment_context.py +flat_api/models/score_comment_creation.py +flat_api/models/score_comment_moderation.py +flat_api/models/score_comment_update.py +flat_api/models/score_comments_counts.py +flat_api/models/score_creation.py +flat_api/models/score_creation_builder_data.py +flat_api/models/score_creation_builder_data_all_of_builder_data.py +flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.py +flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.py +flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py +flat_api/models/score_creation_common.py +flat_api/models/score_creation_file_import.py +flat_api/models/score_creation_google_drive_import.py +flat_api/models/score_creation_type.py +flat_api/models/score_details.py +flat_api/models/score_details_all_of_me.py +flat_api/models/score_fork.py +flat_api/models/score_license.py +flat_api/models/score_likes_counts.py +flat_api/models/score_modification.py +flat_api/models/score_plays_counts.py +flat_api/models/score_privacy.py +flat_api/models/score_revision.py +flat_api/models/score_revision_creation.py +flat_api/models/score_revision_statistics.py +flat_api/models/score_source.py +flat_api/models/score_summary.py +flat_api/models/score_track.py +flat_api/models/score_track_creation.py +flat_api/models/score_track_creation_response.py +flat_api/models/score_track_point.py +flat_api/models/score_track_purpose.py +flat_api/models/score_track_state.py +flat_api/models/score_track_type.py +flat_api/models/score_track_update.py +flat_api/models/score_views_counts.py +flat_api/models/task.py +flat_api/models/task_export_options.py +flat_api/models/task_progress.py +flat_api/models/task_result.py +flat_api/models/teaching_theme.py +flat_api/models/tutteo_product.py +flat_api/models/user_admin_update.py +flat_api/models/user_azure_details.py +flat_api/models/user_basics.py +flat_api/models/user_community_profile_links.py +flat_api/models/user_creation.py +flat_api/models/user_details.py +flat_api/models/user_details_admin.py +flat_api/models/user_details_admin_all_of_license.py +flat_api/models/user_public.py +flat_api/models/user_public_summary.py +flat_api/models/user_signin_link.py +flat_api/models/user_signin_link_creation.py +flat_api/rest.py +flat_api/test/__init__.py +flat_api/test/test_account_api.py +flat_api/test/test_add_group_user200_response.py +flat_api/test/test_add_group_user_request.py +flat_api/test/test_api_access_token.py +flat_api/test/test_app_scopes.py +flat_api/test/test_assignment.py +flat_api/test/test_assignment_capabilities.py +flat_api/test/test_assignment_capabilities_can_publish_in_class_error.py +flat_api/test/test_assignment_copy.py +flat_api/test/test_assignment_copy_response.py +flat_api/test/test_assignment_copy_to_class.py +flat_api/test/test_assignment_copy_to_resource_library.py +flat_api/test/test_assignment_group.py +flat_api/test/test_assignment_submission.py +flat_api/test/test_assignment_submission_comment.py +flat_api/test/test_assignment_submission_comment_creation.py +flat_api/test/test_assignment_submission_comments.py +flat_api/test/test_assignment_submission_history.py +flat_api/test/test_assignment_submission_history_attachment.py +flat_api/test/test_assignment_submission_history_state.py +flat_api/test/test_assignment_submission_lti.py +flat_api/test/test_assignment_submission_playback.py +flat_api/test/test_assignment_submission_state.py +flat_api/test/test_assignment_submission_students_mode.py +flat_api/test/test_assignment_submission_update.py +flat_api/test/test_assignment_type.py +flat_api/test/test_assignment_update.py +flat_api/test/test_class_api.py +flat_api/test/test_class_assignment.py +flat_api/test/test_class_assignment_all_of_canvas.py +flat_api/test/test_class_assignment_all_of_lti.py +flat_api/test/test_class_assignment_all_of_mfc.py +flat_api/test/test_class_assignment_update.py +flat_api/test/test_class_assignment_update_all_of_google_classroom.py +flat_api/test/test_class_assignment_update_all_of_microsoft_graph.py +flat_api/test/test_class_attachment_creation.py +flat_api/test/test_class_creation.py +flat_api/test/test_class_details.py +flat_api/test/test_class_details_canvas.py +flat_api/test/test_class_details_clever.py +flat_api/test/test_class_details_google_classroom.py +flat_api/test/test_class_details_google_drive.py +flat_api/test/test_class_details_issues.py +flat_api/test/test_class_details_issues_sync_inner.py +flat_api/test/test_class_details_lti.py +flat_api/test/test_class_details_mfc.py +flat_api/test/test_class_details_microsoft_graph.py +flat_api/test/test_class_grade_level.py +flat_api/test/test_class_roles.py +flat_api/test/test_class_state.py +flat_api/test/test_class_update.py +flat_api/test/test_collection.py +flat_api/test/test_collection_api.py +flat_api/test/test_collection_app.py +flat_api/test/test_collection_capabilities.py +flat_api/test/test_collection_contents.py +flat_api/test/test_collection_creation.py +flat_api/test/test_collection_modification.py +flat_api/test/test_collection_privacy.py +flat_api/test/test_collection_type.py +flat_api/test/test_credit_transaction.py +flat_api/test/test_edu_library.py +flat_api/test/test_edu_resource.py +flat_api/test/test_edu_resource_assignment_creation.py +flat_api/test/test_edu_resource_capabilities.py +flat_api/test/test_edu_resource_copy.py +flat_api/test/test_edu_resource_creation.py +flat_api/test/test_edu_resource_folder.py +flat_api/test/test_edu_resource_lti_link.py +flat_api/test/test_edu_resource_move.py +flat_api/test/test_edu_resource_privacy.py +flat_api/test/test_edu_resource_resource.py +flat_api/test/test_edu_resource_type.py +flat_api/test/test_edu_resource_update.py +flat_api/test/test_edu_resource_use_in_class.py +flat_api/test/test_edu_resources_api.py +flat_api/test/test_flat_error_response.py +flat_api/test/test_google_classroom_coursework.py +flat_api/test/test_google_classroom_submission.py +flat_api/test/test_grade.py +flat_api/test/test_group.py +flat_api/test/test_group_api.py +flat_api/test/test_group_creation.py +flat_api/test/test_group_details.py +flat_api/test/test_group_type.py +flat_api/test/test_license_mode.py +flat_api/test/test_license_sources.py +flat_api/test/test_lms_name.py +flat_api/test/test_lti_configuration.py +flat_api/test/test_lti_configuration1p1.py +flat_api/test/test_lti_configuration1p1_all_of_tool.py +flat_api/test/test_lti_configuration1p3.py +flat_api/test/test_lti_configuration1p3_base.py +flat_api/test/test_lti_configuration1p3_base_supported_services.py +flat_api/test/test_lti_configuration1p3_base_supported_services_ags.py +flat_api/test/test_lti_configuration1p3_base_supported_services_deep_linking.py +flat_api/test/test_lti_configuration1p3_base_supported_services_nrps.py +flat_api/test/test_lti_configuration1p3_base_tool.py +flat_api/test/test_lti_configuration1p3_deployment.py +flat_api/test/test_lti_configuration1p3_dynamic.py +flat_api/test/test_lti_configuration1p3_manual.py +flat_api/test/test_lti_configuration_base.py +flat_api/test/test_lti_configuration_create.py +flat_api/test/test_lti_configuration_create1p1.py +flat_api/test/test_lti_configuration_create1p3_deployment.py +flat_api/test/test_lti_configuration_create1p3_dynamic.py +flat_api/test/test_lti_configuration_create1p3_dynamic_platform_info.py +flat_api/test/test_lti_configuration_create1p3_manual.py +flat_api/test/test_lti_configuration_update.py +flat_api/test/test_lti_configuration_update_deployment.py +flat_api/test/test_lti_configuration_update_standalone.py +flat_api/test/test_lti_credentials.py +flat_api/test/test_lti_credentials_creation.py +flat_api/test/test_media_attachment.py +flat_api/test/test_media_score_sharing_mode.py +flat_api/test/test_microsoft_graph_assignment.py +flat_api/test/test_microsoft_graph_submission.py +flat_api/test/test_omr_api.py +flat_api/test/test_omr_capabilities.py +flat_api/test/test_omr_details_step_data.py +flat_api/test/test_omr_details_submission.py +flat_api/test/test_omr_detected_instrument.py +flat_api/test/test_omr_imported_metadata.py +flat_api/test/test_omr_instrument_override.py +flat_api/test/test_omr_job.py +flat_api/test/test_omr_job_creation.py +flat_api/test/test_omr_job_file_metadata.py +flat_api/test/test_omr_job_file_upload.py +flat_api/test/test_omr_job_file_upload_result.py +flat_api/test/test_omr_job_input_file.py +flat_api/test/test_omr_job_output.py +flat_api/test/test_omr_job_progress.py +flat_api/test/test_omr_job_result.py +flat_api/test/test_omr_job_retention.py +flat_api/test/test_omr_job_status.py +flat_api/test/test_omr_locale_details.py +flat_api/test/test_omr_pending_step.py +flat_api/test/test_omr_step_name.py +flat_api/test/test_organization_api.py +flat_api/test/test_organization_invitation.py +flat_api/test/test_organization_invitation_creation.py +flat_api/test/test_organization_roles.py +flat_api/test/test_organization_user_access_token_creation.py +flat_api/test/test_rename_group_request.py +flat_api/test/test_resource_collaborator.py +flat_api/test/test_resource_collaborator_creation.py +flat_api/test/test_resource_rights.py +flat_api/test/test_score_api.py +flat_api/test/test_score_comment.py +flat_api/test/test_score_comment_context.py +flat_api/test/test_score_comment_creation.py +flat_api/test/test_score_comment_moderation.py +flat_api/test/test_score_comment_update.py +flat_api/test/test_score_comments_counts.py +flat_api/test/test_score_creation.py +flat_api/test/test_score_creation_builder_data.py +flat_api/test/test_score_creation_builder_data_all_of_builder_data.py +flat_api/test/test_score_creation_builder_data_all_of_builder_data_layout_data.py +flat_api/test/test_score_creation_builder_data_all_of_builder_data_score_data.py +flat_api/test/test_score_creation_builder_data_all_of_builder_data_score_data_instruments.py +flat_api/test/test_score_creation_common.py +flat_api/test/test_score_creation_file_import.py +flat_api/test/test_score_creation_google_drive_import.py +flat_api/test/test_score_creation_type.py +flat_api/test/test_score_details.py +flat_api/test/test_score_details_all_of_me.py +flat_api/test/test_score_fork.py +flat_api/test/test_score_license.py +flat_api/test/test_score_likes_counts.py +flat_api/test/test_score_modification.py +flat_api/test/test_score_plays_counts.py +flat_api/test/test_score_privacy.py +flat_api/test/test_score_revision.py +flat_api/test/test_score_revision_creation.py +flat_api/test/test_score_revision_statistics.py +flat_api/test/test_score_source.py +flat_api/test/test_score_summary.py +flat_api/test/test_score_track.py +flat_api/test/test_score_track_creation.py +flat_api/test/test_score_track_creation_response.py +flat_api/test/test_score_track_point.py +flat_api/test/test_score_track_purpose.py +flat_api/test/test_score_track_state.py +flat_api/test/test_score_track_type.py +flat_api/test/test_score_track_update.py +flat_api/test/test_score_views_counts.py +flat_api/test/test_task.py +flat_api/test/test_task_api.py +flat_api/test/test_task_export_options.py +flat_api/test/test_task_progress.py +flat_api/test/test_task_result.py +flat_api/test/test_teaching_theme.py +flat_api/test/test_tutteo_product.py +flat_api/test/test_user_admin_update.py +flat_api/test/test_user_api.py +flat_api/test/test_user_azure_details.py +flat_api/test/test_user_basics.py +flat_api/test/test_user_community_profile_links.py +flat_api/test/test_user_creation.py +flat_api/test/test_user_details.py +flat_api/test/test_user_details_admin.py +flat_api/test/test_user_details_admin_all_of_license.py +flat_api/test/test_user_public.py +flat_api/test/test_user_public_summary.py +flat_api/test/test_user_signin_link.py +flat_api/test/test_user_signin_link_creation.py +flat_api_README.md 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/.sdkgen.yaml b/.sdkgen.yaml new file mode 100644 index 0000000..577e278 --- /dev/null +++ b/.sdkgen.yaml @@ -0,0 +1,36 @@ +schema_version: 1 + +language: python +package_name: flat-api +registry: pypi + +generator: + name: python + version: 7.24.0 + config: tools/openapi-config.json + # The generator emits sync OR async, never both (T001 spike). The async pass is merged into the + # same package by tools/patches/ so the SDK exposes FlatClient and AsyncFlatClient. + extra_passes: + - name: python + config: tools/openapi-config-async.json + +generated_paths: + - flat_api/** + - docs/reference/** + - .openapi-generator/** + - OPERATIONS.json + +version_file: + path: flat_api/__init__.py + pattern: '__version__ = "(?P[0-9]+\.[0-9]+\.[0-9]+)"' + +runtime_matrix: + - version: '3.11' + upstream_eol: 2027-10-31 + - version: '3.12' + upstream_eol: 2028-10-31 + - version: '3.13' + upstream_eol: 2029-10-31 + +smoke: + entrypoint: tools/smoke.py 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 5e7c29d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -# ref: https://docs.travis-ci.com/user/languages/python -language: python -python: - - "2.7" - - "3.3" - - "3.4" - - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev -# command to install dependencies -install: "pip install -r requirements.txt" -# command to run tests -script: nosetests diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f200a8..8d6b848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,110 @@ # Changelog +## [2.0.3](https://github.com/FlatIO/api-client-python/compare/v2.0.2...v2.0.3) (2026-09-17) + +Identical to 2.0.2. The regeneration pipeline ran twice against API specification 2.26.2 and each run bumps the version, so this release carries no change. + +## [2.0.2](https://github.com/FlatIO/api-client-python/compare/v2.0.1...v2.0.2) (2026-09-17) + +Regenerated against API specification 2.26.2. See the [API changelog](https://flat.io/developers/docs/api/changelog). + +### Features + +* **omr:** `OmrJobCreation.auto_rotate` (`autoRotate`). Off by default; when set, the server detects and corrects pages uploaded sideways or upside down before recognition. `OmrJob` echoes the value. + +### Documentation + +* Descriptions refreshed from the specification: no change on the wire. + +## [2.0.1](https://github.com/FlatIO/api-client-python/compare/v2.0.0...v2.0.1) (2026-09-10) + +### Bug Fixes + +* **docs:** close the asynchronous usage code fence in the README. Two escapes had been written as the literal characters `\n` rather than newlines, so the fence never opened or closed and every section after it rendered inside the code block on PyPI. + +## [2.0.0](https://github.com/FlatIO/api-client-python/compare/v1.1.3...v2.0.0) (2026-09-11) + +The first release of the 2.x line. Regenerated against API specification 2.26.0, covering all 123 +public operations. See [MIGRATION.md](MIGRATION.md) for the upgrade from 1.x. + +### Features + +* Typed errors, retries with backoff, `Link` header pagination and OAuth2 token refresh. +* Both `FlatClient` and `AsyncFlatClient` in one package. The generator emits sync or async and + never both, so the package is generated twice and merged. + +### Breaking Changes + +* Requires Python 3.9 or later. +* Models and operations are regenerated, so names follow the current specification. + +## [1.1.3](https://github.com/FlatIO/api-client-python/compare/v1.1.2...v1.1.3) (2024-03-08) + + +### Bug Fixes + +* **gh:** try fixing version bump by please-release ([bfde710](https://github.com/FlatIO/api-client-python/commit/bfde710d5a9dbaa900247af8478acf43645b5b84)) +* **release:** import version from flat_api ([4283976](https://github.com/FlatIO/api-client-python/commit/4283976e180aa85425cabc5f624fa9bbc73be911)) + +## [1.1.2](https://github.com/FlatIO/api-client-python/compare/v1.1.1...v1.1.2) (2024-03-08) + + +### Bug Fixes + +* bump version to 1.1.0 ([5635ca7](https://github.com/FlatIO/api-client-python/commit/5635ca732a0ad6e671db5b7fd60f7ed5727b7b62)) +* **gh:** missing action step id ([e130408](https://github.com/FlatIO/api-client-python/commit/e130408dd3fd9b937a3b5c3effb4b0ad21697ce0)) + +## [1.1.1](https://github.com/FlatIO/api-client-python/compare/v1.1.0...v1.1.1) (2024-03-08) + + +### Bug Fixes + +* **releasee:** release-please-action -> simple ([03ea4fb](https://github.com/FlatIO/api-client-python/commit/03ea4fbd53f52dda6f3c0abb45da3ab24b3e547d)) + +## [1.1.0](https://github.com/FlatIO/api-client-python/compare/v1.0.0...v1.1.0) (2024-03-08) + + +### Features + +* API 2.20.0 ([5f82d16](https://github.com/FlatIO/api-client-python/commit/5f82d16517bdcda447721026124fa8c2b6f6e077)) + + +### Documentation + +* Update ScoreApi.md ([770ff9d](https://github.com/FlatIO/api-client-python/commit/770ff9d0c6f22294b6b5c3d8f0bff248a8cbc160)) + +## 1.0.0 (API v2.18.0) + +* Updated API from v2.17.0 to v2.18.0 +* Generated with OpenAPI Generator Python 7.0.0-20220526.055920-1 + +## 0.8.1 (API v2.17.0) + +* Fixes binary responses for MIDI export + +## 0.8.0 (API v2.17.0) + +* Updated API from v2.6.0 to v2.17.0 +* Use flatten schema to fix inheritance model issues + +## 0.7.0 (API v2.7.0) + +### Client + +* feat: Add/fix support for python for 3.6 & 3.7 + +### API v2.7.0 + +* update(spec): specify `produces` and `consumes` on endpoints instead of globally +* feat(scores): now support Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and MuseScore files in POST /scores +* feat(scores): add support for `filename` when importing scores +* feat(collections): `parent` collection can now be a collection id when listing collections +* feat(collections): includes parent collections when listing scores +* feat(collections): add `creationDate` property in collection details +* feat(comments): add `staffUuid` for contextualized comments, which will completely replace `staffIdx` in the future +* feat(rights): now return a `isCollaborator` boolean property with the Score or Collection rights +* update(account): added new locales supported + ## 0.6.0 (API v2.6.0) * feat(collections): Add new Collections API endpoints diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 0000000..6f79d0b --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,45 @@ +# Migrating to 2.0.0 + +Version 2.0.0 is a full regeneration of this client against the current Flat API. The previous +release line (1.1.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 PyPI, not withdrawn. Nothing breaks +until you choose to upgrade. + +## Why upgrade + +- **Complete API coverage.** All 119 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 Python 3.11, 3.12 and 3.13. 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: `pip install 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 1.1.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 +2.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..7eb305b --- /dev/null +++ b/OPERATIONS.json @@ -0,0 +1,1217 @@ +{ + "schema_version": 1, + "spec_version": "2.26.2", + "generator": { + "name": "python", + "version": "7.24.0" + }, + "operations": [ + { + "operation_id": "activateClass", + "method": "post", + "path": "/classes/{class}/activate", + "symbol": "class_api.activate_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "addClassUser", + "method": "put", + "path": "/classes/{class}/users/{user}", + "symbol": "class_api.add_class_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "addGroupUser", + "method": "post", + "path": "/groups/{group}/users", + "symbol": "group_api.add_group_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "addOmrJobFile", + "method": "post", + "path": "/omr/jobs/{job}/files", + "symbol": "omr_api.add_omr_job_file", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreCollaborator", + "method": "post", + "path": "/scores/{score}/collaborators", + "symbol": "score_api.add_score_collaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreToCollection", + "method": "put", + "path": "/collections/{collection}/scores/{score}", + "symbol": "collection_api.add_score_to_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "addScoreTrack", + "method": "post", + "path": "/scores/{score}/tracks", + "symbol": "score_api.add_score_track", + "paginated": false, + "documented": true + }, + { + "operation_id": "archiveAssignment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/archive", + "symbol": "class_api.archive_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "archiveClass", + "method": "post", + "path": "/classes/{class}/archive", + "symbol": "class_api.archive_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "cancelOmrJob", + "method": "post", + "path": "/omr/jobs/{job}/cancel", + "symbol": "omr_api.cancel_omr_job", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyAssignment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/copy", + "symbol": "class_api.copy_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyEduResource", + "method": "post", + "path": "/eduResources/{resource}/copy", + "symbol": "edu_resources_api.copy_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "copyEduResourceToDemoClass", + "method": "post", + "path": "/eduResources/{resource}/copyToDemoClass", + "symbol": "edu_resources_api.copy_edu_resource_to_demo_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "countOrgaUsers", + "method": "get", + "path": "/organizations/users/count", + "symbol": "organization_api.count_orga_users", + "paginated": false, + "documented": true + }, + { + "operation_id": "createClass", + "method": "post", + "path": "/classes", + "symbol": "class_api.create_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "createClassAssignment", + "method": "post", + "path": "/classes/{class}/assignments", + "symbol": "class_api.create_class_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "createCollection", + "method": "post", + "path": "/collections", + "symbol": "collection_api.create_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "createEduResource", + "method": "post", + "path": "/eduResources", + "symbol": "edu_resources_api.create_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "createEduResourceLtiLink", + "method": "post", + "path": "/eduResources/{resource}/createLtiLink", + "symbol": "edu_resources_api.create_edu_resource_lti_link", + "paginated": false, + "documented": true + }, + { + "operation_id": "createExportTask", + "method": "post", + "path": "/scores/{score}/revisions/{revision}/{format}/task", + "symbol": "score_api.create_export_task", + "paginated": false, + "documented": true + }, + { + "operation_id": "createGroup", + "method": "post", + "path": "/groups", + "symbol": "group_api.create_group", + "paginated": false, + "documented": true + }, + { + "operation_id": "createLtiConfiguration", + "method": "post", + "path": "/organizations/lti/configurations", + "symbol": "organization_api.create_lti_configuration", + "paginated": false, + "documented": true + }, + { + "operation_id": "createLtiCredentials", + "method": "post", + "path": "/organizations/lti/credentials", + "symbol": "organization_api.create_lti_credentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOmrJob", + "method": "post", + "path": "/omr/jobs", + "symbol": "omr_api.create_omr_job", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationInvitation", + "method": "post", + "path": "/organizations/invitations", + "symbol": "organization_api.create_organization_invitation", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUser", + "method": "post", + "path": "/organizations/users", + "symbol": "organization_api.create_organization_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUserAccessToken", + "method": "post", + "path": "/organizations/users/{user}/accessToken", + "symbol": "organization_api.create_organization_user_access_token", + "paginated": false, + "documented": true + }, + { + "operation_id": "createOrganizationUserSigninLink", + "method": "post", + "path": "/organizations/users/{user}/signinLink", + "symbol": "organization_api.create_organization_user_signin_link", + "paginated": false, + "documented": true + }, + { + "operation_id": "createScore", + "method": "post", + "path": "/scores", + "symbol": "score_api.create_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "createScoreRevision", + "method": "post", + "path": "/scores/{score}/revisions", + "symbol": "score_api.create_score_revision", + "paginated": false, + "documented": true + }, + { + "operation_id": "createSubmission", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions", + "symbol": "class_api.create_submission", + "paginated": false, + "documented": true + }, + { + "operation_id": "createTestStudentAccount", + "method": "post", + "path": "/classes/{class}/testStudent", + "symbol": "class_api.create_test_student_account", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteAssignment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "class_api.delete_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteClassUser", + "method": "delete", + "path": "/classes/{class}/users/{user}", + "symbol": "class_api.delete_class_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteCollection", + "method": "delete", + "path": "/collections/{collection}", + "symbol": "collection_api.delete_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteEduResource", + "method": "delete", + "path": "/eduResources/{resource}", + "symbol": "edu_resources_api.delete_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteGroup", + "method": "delete", + "path": "/groups/{group}", + "symbol": "group_api.delete_group", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteLtiConfiguration", + "method": "delete", + "path": "/organizations/lti/configurations/{configuration}", + "symbol": "organization_api.delete_lti_configuration", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteOmrJob", + "method": "delete", + "path": "/omr/jobs/{job}", + "symbol": "omr_api.delete_omr_job", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScore", + "method": "delete", + "path": "/scores/{score}", + "symbol": "score_api.delete_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreComment", + "method": "delete", + "path": "/scores/{score}/comments/{comment}", + "symbol": "score_api.delete_score_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreFromCollection", + "method": "delete", + "path": "/collections/{collection}/scores/{score}", + "symbol": "collection_api.delete_score_from_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteScoreTrack", + "method": "delete", + "path": "/scores/{score}/tracks/{track}", + "symbol": "score_api.delete_score_track", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteSubmission", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "class_api.delete_submission", + "paginated": false, + "documented": true + }, + { + "operation_id": "deleteSubmissionComment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}", + "symbol": "class_api.delete_submission_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "editCollection", + "method": "put", + "path": "/collections/{collection}", + "symbol": "collection_api.edit_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "editScore", + "method": "put", + "path": "/scores/{score}", + "symbol": "score_api.edit_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "editSubmission", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "class_api.edit_submission", + "paginated": false, + "documented": true + }, + { + "operation_id": "enrollClass", + "method": "post", + "path": "/classes/enroll/{enrollmentCode}", + "symbol": "class_api.enroll_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "exportSubmissionsReviewsAsCsv", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/csv", + "symbol": "class_api.export_submissions_reviews_as_csv", + "paginated": false, + "documented": true + }, + { + "operation_id": "exportSubmissionsReviewsAsExcel", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/excel", + "symbol": "class_api.export_submissions_reviews_as_excel", + "paginated": false, + "documented": true + }, + { + "operation_id": "forkScore", + "method": "post", + "path": "/scores/{score}/fork", + "symbol": "score_api.fork_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "getAssignment", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "class_api.get_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "getAuthenticatedUser", + "method": "get", + "path": "/me", + "symbol": "account_api.get_authenticated_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "getClass", + "method": "get", + "path": "/classes/{class}", + "symbol": "class_api.get_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "getCollection", + "method": "get", + "path": "/collections/{collection}", + "symbol": "collection_api.get_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "getEduResource", + "method": "get", + "path": "/eduResources/{resource}", + "symbol": "edu_resources_api.get_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "getGroupDetails", + "method": "get", + "path": "/groups/{group}", + "symbol": "group_api.get_group_details", + "paginated": false, + "documented": true + }, + { + "operation_id": "getGroupScores", + "method": "get", + "path": "/groups/{group}/scores", + "symbol": "group_api.get_group_scores", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrCapabilities", + "method": "get", + "path": "/omr/capabilities", + "symbol": "omr_api.get_omr_capabilities", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJob", + "method": "get", + "path": "/omr/jobs/{job}", + "symbol": "omr_api.get_omr_job", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJobExport", + "method": "get", + "path": "/omr/jobs/{job}/exports/{format}", + "symbol": "omr_api.get_omr_job_export", + "paginated": false, + "documented": true + }, + { + "operation_id": "getOmrJobFile", + "method": "get", + "path": "/omr/jobs/{job}/files/{index}", + "symbol": "omr_api.get_omr_job_file", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScore", + "method": "get", + "path": "/scores/{score}", + "symbol": "score_api.get_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreCollaborator", + "method": "get", + "path": "/scores/{score}/collaborators/{collaborator}", + "symbol": "score_api.get_score_collaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreCollaborators", + "method": "get", + "path": "/scores/{score}/collaborators", + "symbol": "score_api.get_score_collaborators", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreComments", + "method": "get", + "path": "/scores/{score}/comments", + "symbol": "score_api.get_score_comments", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevision", + "method": "get", + "path": "/scores/{score}/revisions/{revision}", + "symbol": "score_api.get_score_revision", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevisionData", + "method": "get", + "path": "/scores/{score}/revisions/{revision}/{format}", + "symbol": "score_api.get_score_revision_data", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreRevisions", + "method": "get", + "path": "/scores/{score}/revisions", + "symbol": "score_api.get_score_revisions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreSubmissions", + "method": "get", + "path": "/scores/{score}/submissions", + "symbol": "score_api.get_score_submissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getScoreTrack", + "method": "get", + "path": "/scores/{score}/tracks/{track}", + "symbol": "score_api.get_score_track", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmission", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}", + "symbol": "class_api.get_submission", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissionComments", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments", + "symbol": "class_api.get_submission_comments", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissionHistory", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/history", + "symbol": "class_api.get_submission_history", + "paginated": false, + "documented": true + }, + { + "operation_id": "getSubmissions", + "method": "get", + "path": "/classes/{class}/assignments/{assignment}/submissions", + "symbol": "class_api.get_submissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "getTask", + "method": "get", + "path": "/tasks/{task}", + "symbol": "task_api.get_task", + "paginated": false, + "documented": true + }, + { + "operation_id": "getUser", + "method": "get", + "path": "/users/{user}", + "symbol": "user_api.get_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "getUserLikes", + "method": "get", + "path": "/users/{user}/likes", + "symbol": "score_api.get_user_likes", + "paginated": true, + "documented": true + }, + { + "operation_id": "getUserScores", + "method": "get", + "path": "/users/{user}/scores", + "symbol": "score_api.get_user_scores", + "paginated": true, + "documented": true + }, + { + "operation_id": "listAssignments", + "method": "get", + "path": "/classes/{class}/assignments", + "symbol": "class_api.list_assignments", + "paginated": false, + "documented": true + }, + { + "operation_id": "listBillingCreditsHistory", + "method": "get", + "path": "/billing/credits/history", + "symbol": "omr_api.list_billing_credits_history", + "paginated": true, + "documented": true + }, + { + "operation_id": "listClassStudentSubmissions", + "method": "get", + "path": "/classes/{class}/students/{user}/submissions", + "symbol": "class_api.list_class_student_submissions", + "paginated": false, + "documented": true + }, + { + "operation_id": "listClasses", + "method": "get", + "path": "/classes", + "symbol": "class_api.list_classes", + "paginated": false, + "documented": true + }, + { + "operation_id": "listCollectionScores", + "method": "get", + "path": "/collections/{collection}/scores", + "symbol": "collection_api.list_collection_scores", + "paginated": true, + "documented": true + }, + { + "operation_id": "listCollections", + "method": "get", + "path": "/collections", + "symbol": "collection_api.list_collections", + "paginated": true, + "documented": true + }, + { + "operation_id": "listEduLibraries", + "method": "get", + "path": "/eduResources/libraries", + "symbol": "edu_resources_api.list_edu_libraries", + "paginated": false, + "documented": true + }, + { + "operation_id": "listEduResources", + "method": "get", + "path": "/eduResources", + "symbol": "edu_resources_api.list_edu_resources", + "paginated": true, + "documented": true + }, + { + "operation_id": "listGroupUsers", + "method": "get", + "path": "/groups/{group}/users", + "symbol": "group_api.list_group_users", + "paginated": false, + "documented": true + }, + { + "operation_id": "listGroups", + "method": "get", + "path": "/groups", + "symbol": "group_api.list_groups", + "paginated": false, + "documented": false + }, + { + "operation_id": "listLtiConfigurations", + "method": "get", + "path": "/organizations/lti/configurations", + "symbol": "organization_api.list_lti_configurations", + "paginated": false, + "documented": true + }, + { + "operation_id": "listLtiCredentials", + "method": "get", + "path": "/organizations/lti/credentials", + "symbol": "organization_api.list_lti_credentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "listOmrJobs", + "method": "get", + "path": "/omr/jobs", + "symbol": "omr_api.list_omr_jobs", + "paginated": true, + "documented": true + }, + { + "operation_id": "listOrganizationInvitations", + "method": "get", + "path": "/organizations/invitations", + "symbol": "organization_api.list_organization_invitations", + "paginated": true, + "documented": true + }, + { + "operation_id": "listOrganizationUsers", + "method": "get", + "path": "/organizations/users", + "symbol": "organization_api.list_organization_users", + "paginated": true, + "documented": true + }, + { + "operation_id": "listScoreTracks", + "method": "get", + "path": "/scores/{score}/tracks", + "symbol": "score_api.list_score_tracks", + "paginated": false, + "documented": true + }, + { + "operation_id": "markScoreCommentResolved", + "method": "put", + "path": "/scores/{score}/comments/{comment}/resolved", + "symbol": "score_api.mark_score_comment_resolved", + "paginated": false, + "documented": true + }, + { + "operation_id": "markScoreCommentUnresolved", + "method": "delete", + "path": "/scores/{score}/comments/{comment}/resolved", + "symbol": "score_api.mark_score_comment_unresolved", + "paginated": false, + "documented": true + }, + { + "operation_id": "moveEduResource", + "method": "post", + "path": "/eduResources/{resource}/move", + "symbol": "edu_resources_api.move_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "postScoreComment", + "method": "post", + "path": "/scores/{score}/comments", + "symbol": "score_api.post_score_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "postSubmissionComment", + "method": "post", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments", + "symbol": "class_api.post_submission_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeGroupUser", + "method": "delete", + "path": "/groups/{group}/users/{user}", + "symbol": "group_api.remove_group_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeOrganizationInvitation", + "method": "delete", + "path": "/organizations/invitations/{invitation}", + "symbol": "organization_api.remove_organization_invitation", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeOrganizationUser", + "method": "delete", + "path": "/organizations/users/{user}", + "symbol": "organization_api.remove_organization_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "removeScoreCollaborator", + "method": "delete", + "path": "/scores/{score}/collaborators/{collaborator}", + "symbol": "score_api.remove_score_collaborator", + "paginated": false, + "documented": true + }, + { + "operation_id": "renameGroup", + "method": "put", + "path": "/groups/{group}", + "symbol": "group_api.rename_group", + "paginated": false, + "documented": true + }, + { + "operation_id": "revokeLtiCredentials", + "method": "delete", + "path": "/organizations/lti/credentials/{credentials}", + "symbol": "organization_api.revoke_lti_credentials", + "paginated": false, + "documented": true + }, + { + "operation_id": "startOmrJob", + "method": "post", + "path": "/omr/jobs/{job}/start", + "symbol": "omr_api.start_omr_job", + "paginated": false, + "documented": true + }, + { + "operation_id": "submitOmrJobStep", + "method": "post", + "path": "/omr/jobs/{job}/steps/{step}", + "symbol": "omr_api.submit_omr_job_step", + "paginated": false, + "documented": true + }, + { + "operation_id": "unarchiveAssignment", + "method": "delete", + "path": "/classes/{class}/assignments/{assignment}/archive", + "symbol": "class_api.unarchive_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "unarchiveClass", + "method": "delete", + "path": "/classes/{class}/archive", + "symbol": "class_api.unarchive_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "untrashCollection", + "method": "post", + "path": "/collections/{collection}/untrash", + "symbol": "collection_api.untrash_collection", + "paginated": false, + "documented": true + }, + { + "operation_id": "untrashScore", + "method": "post", + "path": "/scores/{score}/untrash", + "symbol": "score_api.untrash_score", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateClass", + "method": "put", + "path": "/classes/{class}", + "symbol": "class_api.update_class", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateClassAssignment", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}", + "symbol": "class_api.update_class_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateEduResource", + "method": "put", + "path": "/eduResources/{resource}", + "symbol": "edu_resources_api.update_edu_resource", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateEduResourceAssignment", + "method": "put", + "path": "/eduResources/{resource}/assignment", + "symbol": "edu_resources_api.update_edu_resource_assignment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateLtiConfiguration", + "method": "put", + "path": "/organizations/lti/configurations/{configuration}", + "symbol": "organization_api.update_lti_configuration", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateOrganizationUser", + "method": "put", + "path": "/organizations/users/{user}", + "symbol": "organization_api.update_organization_user", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateScoreComment", + "method": "put", + "path": "/scores/{score}/comments/{comment}", + "symbol": "score_api.update_score_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateScoreTrack", + "method": "put", + "path": "/scores/{score}/tracks/{track}", + "symbol": "score_api.update_score_track", + "paginated": false, + "documented": true + }, + { + "operation_id": "updateSubmissionComment", + "method": "put", + "path": "/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}", + "symbol": "class_api.update_submission_comment", + "paginated": false, + "documented": true + }, + { + "operation_id": "useEduResourceInClass", + "method": "post", + "path": "/eduResources/{resource}/useInClass", + "symbol": "edu_resources_api.use_edu_resource_in_class", + "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", + "OmrCapabilities", + "OmrDetailsStepData", + "OmrDetailsSubmission", + "OmrDetectedInstrument", + "OmrImportedMetadata", + "OmrInstrumentOverride", + "OmrJob", + "OmrJobCreation", + "OmrJobFileMetadata", + "OmrJobFileUpload", + "OmrJobFileUploadResult", + "OmrJobInputFile", + "OmrJobOutput", + "OmrJobProgress", + "OmrJobResult", + "OmrJobRetention", + "OmrJobStatus", + "OmrLocaleDetails", + "OmrPendingStep", + "OmrStepName", + "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..c17fd46 --- /dev/null +++ b/QUICKSTART.md @@ -0,0 +1,64 @@ +# 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 +pip install flat-api +``` + +Requires Python 3.11, 3.12 and 3.13. + +## 3. Call the API + +```python +from flat_api import FlatClient + +client = FlatClient(access_token="YOUR_TOKEN") +me = client.api_client # generated APIs hang off here +``` + +If that prints your account, you are done. + +## 4. Do something useful + +List your scores. The client handles paging for you: + +```python +from flat_api import paginate + +for score in paginate(api.get_user_scores_with_http_info, user="me"): + print(score.title) +``` + +## 5. Handle failure properly + +```python +from flat_api import FlatRateLimitError, FlatNotFoundError + +try: + ... +except FlatRateLimitError as exc: + print("retry after", exc.reset) +except FlatNotFoundError: + print("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 d652da6..a079da4 100644 --- a/README.md +++ b/README.md @@ -1,275 +1,98 @@ -# Python Client for the Flat REST API +# Flat API client for Python -[![Build Status](https://travis-ci.org/FlatIO/api-client-python.svg?branch=master)](https://travis-ci.org/FlatIO/api-client-python) - -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. - -Python 2.7 to 3.5+ - -## Installation & Usage -### pip install - -```sh -pip install 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. ```sh -pip install git+https://github.com/FlatIO/api-client-python.git +pip install flat-api ``` -Then import the package: ```python -import flat_api +from flat_api import FlatClient + +client = FlatClient(access_token="YOUR_TOKEN") +me = client.api_client # generated APIs hang off here ``` -### Setuptools +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. -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). +## What this client does for you -```sh -python setup.py install --user -``` -(or `sudo python setup.py install` to install the package for all users) +- **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. + +### Pagination -Then import the package: ```python -import flat_api -``` +from flat_api import paginate -## Getting Started +for score in paginate(api.get_user_scores_with_http_info, user="me"): + print(score.title) +``` -Please follow the installation procedure above and then run the following: +### Errors ```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -configuration = flat_api.Configuration() -# Configure your personal access token or OAuth2 access token -configuration.access_token = 'YOUR_ACCESS_TOKEN' -flat_api_client = flat_api.ApiClient(configuration) - -# create an instance of the API class -api_instance = flat_api.AccountApi(flat_api_client) +from flat_api import FlatRateLimitError, FlatNotFoundError try: - # Get current user profile - api_response = api_instance.get_authenticated_user() - pprint(api_response) -except ApiException as e: - print("Exception when calling AccountApi->get_authenticated_user: %s\n" % e) - + ... +except FlatRateLimitError as exc: + print("retry after", exc.reset) +except FlatNotFoundError: + print("no such score") ``` -## Documentation for API Endpoints +### Asynchronous use + +```python +from flat_api import AsyncFlatClient -All URIs are relative to *https://api.flat.io/v2* +client = AsyncFlatClient(access_token="YOUR_TOKEN") +# every operation is awaitable +``` -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AccountApi* | [**get_authenticated_user**](docs/AccountApi.md#get_authenticated_user) | **GET** /me | Get current user profile -*ClassApi* | [**activate_class**](docs/ClassApi.md#activate_class) | **POST** /classes/{class}/activate | Activate the class -*ClassApi* | [**add_class_user**](docs/ClassApi.md#add_class_user) | **PUT** /classes/{class}/users/{user} | Add a user to the class -*ClassApi* | [**archive_class**](docs/ClassApi.md#archive_class) | **POST** /classes/{class}/archive | Archive the class -*ClassApi* | [**copy_assignment**](docs/ClassApi.md#copy_assignment) | **POST** /classes/{class}/assignments/{assignment}/copy | Copy an assignment -*ClassApi* | [**create_assignment**](docs/ClassApi.md#create_assignment) | **POST** /classes/{class}/assignments | Assignment creation -*ClassApi* | [**create_class**](docs/ClassApi.md#create_class) | **POST** /classes | Create a new class -*ClassApi* | [**create_submission**](docs/ClassApi.md#create_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission -*ClassApi* | [**delete_class_user**](docs/ClassApi.md#delete_class_user) | **DELETE** /classes/{class}/users/{user} | Remove a user from the class -*ClassApi* | [**edit_submission**](docs/ClassApi.md#edit_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission -*ClassApi* | [**enroll_class**](docs/ClassApi.md#enroll_class) | **POST** /classes/enroll/{enrollmentCode} | Join a class -*ClassApi* | [**get_class**](docs/ClassApi.md#get_class) | **GET** /classes/{class} | Get the details of a single class -*ClassApi* | [**get_score_submissions**](docs/ClassApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score -*ClassApi* | [**get_submission**](docs/ClassApi.md#get_submission) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission -*ClassApi* | [**get_submissions**](docs/ClassApi.md#get_submissions) | **GET** /classes/{class}/assignments/{assignment}/submissions | List the students' submissions -*ClassApi* | [**list_assignments**](docs/ClassApi.md#list_assignments) | **GET** /classes/{class}/assignments | Assignments listing -*ClassApi* | [**list_class_student_submissions**](docs/ClassApi.md#list_class_student_submissions) | **GET** /classes/{class}/students/{user}/submissions | List the submissions for a student -*ClassApi* | [**list_classes**](docs/ClassApi.md#list_classes) | **GET** /classes | List the classes available for the current user -*ClassApi* | [**unarchive_class**](docs/ClassApi.md#unarchive_class) | **DELETE** /classes/{class}/archive | Unarchive the class -*ClassApi* | [**update_class**](docs/ClassApi.md#update_class) | **PUT** /classes/{class} | Update the class -*CollectionApi* | [**add_score_to_collection**](docs/CollectionApi.md#add_score_to_collection) | **PUT** /collections/{collection}/scores/{score} | Add a score to the collection -*CollectionApi* | [**create_collection**](docs/CollectionApi.md#create_collection) | **POST** /collections | Create a new collection -*CollectionApi* | [**delete_collection**](docs/CollectionApi.md#delete_collection) | **DELETE** /collections/{collection} | Delete the collection -*CollectionApi* | [**delete_score_from_collection**](docs/CollectionApi.md#delete_score_from_collection) | **DELETE** /collections/{collection}/scores/{score} | Delete a score from the collection -*CollectionApi* | [**edit_collection**](docs/CollectionApi.md#edit_collection) | **PUT** /collections/{collection} | Update a collection's metadata -*CollectionApi* | [**get_collection**](docs/CollectionApi.md#get_collection) | **GET** /collections/{collection} | Get collection details -*CollectionApi* | [**list_collection_scores**](docs/CollectionApi.md#list_collection_scores) | **GET** /collections/{collection}/scores | List the scores contained in a collection -*CollectionApi* | [**list_collections**](docs/CollectionApi.md#list_collections) | **GET** /collections | List the collections -*CollectionApi* | [**untrash_collection**](docs/CollectionApi.md#untrash_collection) | **POST** /collections/{collection}/untrash | Untrash a collection -*GroupApi* | [**get_group_details**](docs/GroupApi.md#get_group_details) | **GET** /groups/{group} | Get group information -*GroupApi* | [**get_group_scores**](docs/GroupApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores -*GroupApi* | [**list_group_users**](docs/GroupApi.md#list_group_users) | **GET** /groups/{group}/users | List group's users -*OrganizationApi* | [**create_lti_credentials**](docs/OrganizationApi.md#create_lti_credentials) | **POST** /organizations/lti/credentials | Create a new couple of LTI 1.x credentials -*OrganizationApi* | [**create_organization_invitation**](docs/OrganizationApi.md#create_organization_invitation) | **POST** /organizations/invitations | Create a new invitation to join the organization -*OrganizationApi* | [**create_organization_user**](docs/OrganizationApi.md#create_organization_user) | **POST** /organizations/users | Create a new user account -*OrganizationApi* | [**list_lti_credentials**](docs/OrganizationApi.md#list_lti_credentials) | **GET** /organizations/lti/credentials | List LTI 1.x credentials -*OrganizationApi* | [**list_organization_invitations**](docs/OrganizationApi.md#list_organization_invitations) | **GET** /organizations/invitations | List the organization invitations -*OrganizationApi* | [**list_organization_users**](docs/OrganizationApi.md#list_organization_users) | **GET** /organizations/users | List the organization users -*OrganizationApi* | [**remove_organization_invitation**](docs/OrganizationApi.md#remove_organization_invitation) | **DELETE** /organizations/invitations/{invitation} | Remove an organization invitation -*OrganizationApi* | [**remove_organization_user**](docs/OrganizationApi.md#remove_organization_user) | **DELETE** /organizations/users/{user} | Remove an account from Flat -*OrganizationApi* | [**revoke_lti_credentials**](docs/OrganizationApi.md#revoke_lti_credentials) | **DELETE** /organizations/lti/credentials/{credentials} | Revoke LTI 1.x credentials -*OrganizationApi* | [**update_organization_user**](docs/OrganizationApi.md#update_organization_user) | **PUT** /organizations/users/{user} | Update account information -*ScoreApi* | [**add_score_collaborator**](docs/ScoreApi.md#add_score_collaborator) | **POST** /scores/{score}/collaborators | Add a new collaborator -*ScoreApi* | [**add_score_track**](docs/ScoreApi.md#add_score_track) | **POST** /scores/{score}/tracks | Add a new video or audio track to the score -*ScoreApi* | [**create_score**](docs/ScoreApi.md#create_score) | **POST** /scores | Create a new score -*ScoreApi* | [**create_score_revision**](docs/ScoreApi.md#create_score_revision) | **POST** /scores/{score}/revisions | Create a new revision -*ScoreApi* | [**delete_score**](docs/ScoreApi.md#delete_score) | **DELETE** /scores/{score} | Delete a score -*ScoreApi* | [**delete_score_comment**](docs/ScoreApi.md#delete_score_comment) | **DELETE** /scores/{score}/comments/{comment} | Delete a comment -*ScoreApi* | [**delete_score_track**](docs/ScoreApi.md#delete_score_track) | **DELETE** /scores/{score}/tracks/{track} | Remove an audio or video track linked to the score -*ScoreApi* | [**edit_score**](docs/ScoreApi.md#edit_score) | **PUT** /scores/{score} | Edit a score's metadata -*ScoreApi* | [**fork_score**](docs/ScoreApi.md#fork_score) | **POST** /scores/{score}/fork | Fork a score -*ScoreApi* | [**ger_user_likes**](docs/ScoreApi.md#ger_user_likes) | **GET** /users/{user}/likes | List liked scores -*ScoreApi* | [**get_group_scores**](docs/ScoreApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores -*ScoreApi* | [**get_score**](docs/ScoreApi.md#get_score) | **GET** /scores/{score} | Get a score's metadata -*ScoreApi* | [**get_score_collaborator**](docs/ScoreApi.md#get_score_collaborator) | **GET** /scores/{score}/collaborators/{collaborator} | Get a collaborator -*ScoreApi* | [**get_score_collaborators**](docs/ScoreApi.md#get_score_collaborators) | **GET** /scores/{score}/collaborators | List the collaborators -*ScoreApi* | [**get_score_comments**](docs/ScoreApi.md#get_score_comments) | **GET** /scores/{score}/comments | List comments -*ScoreApi* | [**get_score_revision**](docs/ScoreApi.md#get_score_revision) | **GET** /scores/{score}/revisions/{revision} | Get a score revision -*ScoreApi* | [**get_score_revision_data**](docs/ScoreApi.md#get_score_revision_data) | **GET** /scores/{score}/revisions/{revision}/{format} | Get a score revision data -*ScoreApi* | [**get_score_revisions**](docs/ScoreApi.md#get_score_revisions) | **GET** /scores/{score}/revisions | List the revisions -*ScoreApi* | [**get_score_submissions**](docs/ScoreApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score -*ScoreApi* | [**get_score_track**](docs/ScoreApi.md#get_score_track) | **GET** /scores/{score}/tracks/{track} | Retrieve the details of an audio or video track linked to a score -*ScoreApi* | [**get_user_scores**](docs/ScoreApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores -*ScoreApi* | [**list_score_tracks**](docs/ScoreApi.md#list_score_tracks) | **GET** /scores/{score}/tracks | List the audio or video tracks linked to a score -*ScoreApi* | [**mark_score_comment_resolved**](docs/ScoreApi.md#mark_score_comment_resolved) | **PUT** /scores/{score}/comments/{comment}/resolved | Mark the comment as resolved -*ScoreApi* | [**mark_score_comment_unresolved**](docs/ScoreApi.md#mark_score_comment_unresolved) | **DELETE** /scores/{score}/comments/{comment}/resolved | Mark the comment as unresolved -*ScoreApi* | [**post_score_comment**](docs/ScoreApi.md#post_score_comment) | **POST** /scores/{score}/comments | Post a new comment -*ScoreApi* | [**remove_score_collaborator**](docs/ScoreApi.md#remove_score_collaborator) | **DELETE** /scores/{score}/collaborators/{collaborator} | Delete a collaborator -*ScoreApi* | [**untrash_score**](docs/ScoreApi.md#untrash_score) | **POST** /scores/{score}/untrash | Untrash a score -*ScoreApi* | [**update_score_comment**](docs/ScoreApi.md#update_score_comment) | **PUT** /scores/{score}/comments/{comment} | Update an existing comment -*ScoreApi* | [**update_score_track**](docs/ScoreApi.md#update_score_track) | **PUT** /scores/{score}/tracks/{track} | Update an audio or video track linked to a score -*UserApi* | [**ger_user_likes**](docs/UserApi.md#ger_user_likes) | **GET** /users/{user}/likes | List liked scores -*UserApi* | [**get_user**](docs/UserApi.md#get_user) | **GET** /users/{user} | Get a public user profile -*UserApi* | [**get_user_scores**](docs/UserApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores +## Supported versions +Python 3.11, 3.12 and 3.13. 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/Assignment.md) - - [AssignmentCopy](docs/AssignmentCopy.md) - - [AssignmentCreation](docs/AssignmentCreation.md) - - [AssignmentSubmission](docs/AssignmentSubmission.md) - - [AssignmentSubmissionUpdate](docs/AssignmentSubmissionUpdate.md) - - [ClassAttachmentCreation](docs/ClassAttachmentCreation.md) - - [ClassCreation](docs/ClassCreation.md) - - [ClassDetails](docs/ClassDetails.md) - - [ClassDetailsCanvas](docs/ClassDetailsCanvas.md) - - [ClassDetailsClever](docs/ClassDetailsClever.md) - - [ClassDetailsGoogleClassroom](docs/ClassDetailsGoogleClassroom.md) - - [ClassDetailsGoogleDrive](docs/ClassDetailsGoogleDrive.md) - - [ClassDetailsLti](docs/ClassDetailsLti.md) - - [ClassRoles](docs/ClassRoles.md) - - [ClassState](docs/ClassState.md) - - [ClassUpdate](docs/ClassUpdate.md) - - [Collection](docs/Collection.md) - - [CollectionCapabilities](docs/CollectionCapabilities.md) - - [CollectionCreation](docs/CollectionCreation.md) - - [CollectionModification](docs/CollectionModification.md) - - [CollectionPrivacy](docs/CollectionPrivacy.md) - - [CollectionTitle](docs/CollectionTitle.md) - - [CollectionType](docs/CollectionType.md) - - [FlatErrorResponse](docs/FlatErrorResponse.md) - - [FlatLocales](docs/FlatLocales.md) - - [GoogleClassroomCoursework](docs/GoogleClassroomCoursework.md) - - [GoogleClassroomSubmission](docs/GoogleClassroomSubmission.md) - - [Group](docs/Group.md) - - [GroupDetails](docs/GroupDetails.md) - - [GroupType](docs/GroupType.md) - - [LicenseMode](docs/LicenseMode.md) - - [LicenseSources](docs/LicenseSources.md) - - [LmsName](docs/LmsName.md) - - [LtiCredentials](docs/LtiCredentials.md) - - [LtiCredentialsCreation](docs/LtiCredentialsCreation.md) - - [MediaAttachment](docs/MediaAttachment.md) - - [MediaScoreSharingMode](docs/MediaScoreSharingMode.md) - - [OrganizationInvitation](docs/OrganizationInvitation.md) - - [OrganizationInvitationCreation](docs/OrganizationInvitationCreation.md) - - [OrganizationRoles](docs/OrganizationRoles.md) - - [ResourceCollaboratorCreation](docs/ResourceCollaboratorCreation.md) - - [ResourceRights](docs/ResourceRights.md) - - [ResourceSharingKey](docs/ResourceSharingKey.md) - - [ScoreComment](docs/ScoreComment.md) - - [ScoreCommentContext](docs/ScoreCommentContext.md) - - [ScoreCommentCreation](docs/ScoreCommentCreation.md) - - [ScoreCommentUpdate](docs/ScoreCommentUpdate.md) - - [ScoreCommentsCounts](docs/ScoreCommentsCounts.md) - - [ScoreCreation](docs/ScoreCreation.md) - - [ScoreCreationType](docs/ScoreCreationType.md) - - [ScoreData](docs/ScoreData.md) - - [ScoreDataEncoding](docs/ScoreDataEncoding.md) - - [ScoreFork](docs/ScoreFork.md) - - [ScoreLicense](docs/ScoreLicense.md) - - [ScoreLikesCounts](docs/ScoreLikesCounts.md) - - [ScoreModification](docs/ScoreModification.md) - - [ScorePrivacy](docs/ScorePrivacy.md) - - [ScoreRevision](docs/ScoreRevision.md) - - [ScoreRevisionCreation](docs/ScoreRevisionCreation.md) - - [ScoreRevisionStatistics](docs/ScoreRevisionStatistics.md) - - [ScoreSource](docs/ScoreSource.md) - - [ScoreSummary](docs/ScoreSummary.md) - - [ScoreTrack](docs/ScoreTrack.md) - - [ScoreTrackCreation](docs/ScoreTrackCreation.md) - - [ScoreTrackPoint](docs/ScoreTrackPoint.md) - - [ScoreTrackState](docs/ScoreTrackState.md) - - [ScoreTrackType](docs/ScoreTrackType.md) - - [ScoreTrackUpdate](docs/ScoreTrackUpdate.md) - - [ScoreViewsCounts](docs/ScoreViewsCounts.md) - - [UserAdminUpdate](docs/UserAdminUpdate.md) - - [UserBasics](docs/UserBasics.md) - - [UserCreation](docs/UserCreation.md) - - [UserDetailsAdminLicense](docs/UserDetailsAdminLicense.md) - - [UserInstruments](docs/UserInstruments.md) - - [ResourceCollaborator](docs/ResourceCollaborator.md) - - [ScoreDetails](docs/ScoreDetails.md) - - [UserPublicSummary](docs/UserPublicSummary.md) - - [UserDetailsAdmin](docs/UserDetailsAdmin.md) - - [UserPublic](docs/UserPublic.md) - - [UserDetails](docs/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 1.1.x](MIGRATION.md) +## Verifying this package -## Documentation For Authorization +Every release carries a signed provenance attestation linking the package back to the commit, the +workflow run that built it, and the API specification version it was generated from. +```sh +pip download --no-deps flat-api +gh attestation verify flat_api-*.whl --repo FlatIO/api-client-python +``` -## OAuth2 +Published through PyPI trusted publishing: no long-lived token exists that could publish under this +name. -- **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. +## How this client is maintained +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. -## Author +Files under `docs/reference/` and the client sources are generated: edit the generator configuration +in `tools/`, not the output. -developers@flat.io +## License +Apache 2.0. See [LICENSE](LICENSE). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..2165f8f --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.4 diff --git a/docs/AccountApi.md b/docs/AccountApi.md deleted file mode 100644 index ddc7c63..0000000 --- a/docs/AccountApi.md +++ /dev/null @@ -1,57 +0,0 @@ -# flat_api.AccountApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_authenticated_user**](AccountApi.md#get_authenticated_user) | **GET** /me | Get current user profile - - -# **get_authenticated_user** -> UserDetails get_authenticated_user() - -Get current user profile - -Get details about the current authenticated User. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.AccountApi(flat_api.ApiClient(configuration)) - -try: - # Get current user profile - api_response = api_instance.get_authenticated_user() - pprint(api_response) -except ApiException as e: - print("Exception when calling AccountApi->get_authenticated_user: %s\n" % e) -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**UserDetails**](UserDetails.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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/Assignment.md b/docs/Assignment.md deleted file mode 100644 index 4ff32d0..0000000 --- a/docs/Assignment.md +++ /dev/null @@ -1,20 +0,0 @@ -# Assignment - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**state** | **str** | State of the assignment | [optional] -**title** | **str** | Title of the assignment | [optional] -**classroom** | **str** | The unique identifier of the class where this assignment was posted | [optional] -**description** | **str** | Description and content of the assignment | [optional] -**attachments** | [**list[MediaAttachment]**](MediaAttachment.md) | | [optional] -**submissions** | [**list[AssignmentSubmission]**](AssignmentSubmission.md) | | [optional] -**creator** | **str** | The User unique identifier of the creator of this assignment | [optional] -**creation_date** | **datetime** | The creation date of this assignment | [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] -**due_date** | **datetime** | The due date of this assignment, late submissions will be marked as paste due. | [optional] -**google_classroom** | [**GoogleClassroomCoursework**](GoogleClassroomCoursework.md) | | [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/AssignmentCopy.md b/docs/AssignmentCopy.md deleted file mode 100644 index 361827b..0000000 --- a/docs/AssignmentCopy.md +++ /dev/null @@ -1,10 +0,0 @@ -# AssignmentCopy - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**classroom** | **str** | The destination classroom where the assignment will be copied | - -[[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/AssignmentCreation.md b/docs/AssignmentCreation.md deleted file mode 100644 index b9fc9f4..0000000 --- a/docs/AssignmentCreation.md +++ /dev/null @@ -1,14 +0,0 @@ -# AssignmentCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **str** | Title of the assignment | [optional] -**description** | **str** | Description and content of the assignment | [optional] -**attachments** | [**list[ClassAttachmentCreation]**](ClassAttachmentCreation.md) | | [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] - -[[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/AssignmentSubmission.md b/docs/AssignmentSubmission.md deleted file mode 100644 index 98d2901..0000000 --- a/docs/AssignmentSubmission.md +++ /dev/null @@ -1,21 +0,0 @@ -# AssignmentSubmission - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Unique identifier of the submission | [optional] -**classroom** | **str** | Unique identifier of the classroom where the assignment was posted | [optional] -**assignment** | **str** | Unique identifier of the assignment | [optional] -**creator** | **str** | The User identifier of the student who created the submission | [optional] -**creation_date** | **str** | The date when the submission was created | [optional] -**attachments** | [**list[MediaAttachment]**](MediaAttachment.md) | | [optional] -**submission_date** | **str** | The date when the student submitted his work | [optional] -**student_comment** | **str** | An optionnal comment sent by the student when submitting his work | [optional] -**return_date** | **str** | The date when the teacher returned the work | [optional] -**return_feedback** | **str** | The feedback associated with the return | [optional] -**return_creator** | **str** | The User unique identifier of the teacher who returned the submission | [optional] -**google_classroom** | [**GoogleClassroomSubmission**](GoogleClassroomSubmission.md) | | [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/AssignmentSubmissionUpdate.md b/docs/AssignmentSubmissionUpdate.md deleted file mode 100644 index 268280f..0000000 --- a/docs/AssignmentSubmissionUpdate.md +++ /dev/null @@ -1,13 +0,0 @@ -# AssignmentSubmissionUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**attachments** | [**list[ClassAttachmentCreation]**](ClassAttachmentCreation.md) | | [optional] -**student_comment** | **str** | An optionnal comment sent by the student when submitting his work | [optional] -**submit** | **bool** | If `true`, the submission will be marked as done | [optional] -**return_feedback** | **str** | The feedback associated with the return | [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/ClassApi.md b/docs/ClassApi.md deleted file mode 100644 index 3b65bf3..0000000 --- a/docs/ClassApi.md +++ /dev/null @@ -1,1033 +0,0 @@ -# flat_api.ClassApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**activate_class**](ClassApi.md#activate_class) | **POST** /classes/{class}/activate | Activate the class -[**add_class_user**](ClassApi.md#add_class_user) | **PUT** /classes/{class}/users/{user} | Add a user to the class -[**archive_class**](ClassApi.md#archive_class) | **POST** /classes/{class}/archive | Archive the class -[**copy_assignment**](ClassApi.md#copy_assignment) | **POST** /classes/{class}/assignments/{assignment}/copy | Copy an assignment -[**create_assignment**](ClassApi.md#create_assignment) | **POST** /classes/{class}/assignments | Assignment creation -[**create_class**](ClassApi.md#create_class) | **POST** /classes | Create a new class -[**create_submission**](ClassApi.md#create_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission -[**delete_class_user**](ClassApi.md#delete_class_user) | **DELETE** /classes/{class}/users/{user} | Remove a user from the class -[**edit_submission**](ClassApi.md#edit_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission -[**enroll_class**](ClassApi.md#enroll_class) | **POST** /classes/enroll/{enrollmentCode} | Join a class -[**get_class**](ClassApi.md#get_class) | **GET** /classes/{class} | Get the details of a single class -[**get_score_submissions**](ClassApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score -[**get_submission**](ClassApi.md#get_submission) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission -[**get_submissions**](ClassApi.md#get_submissions) | **GET** /classes/{class}/assignments/{assignment}/submissions | List the students' submissions -[**list_assignments**](ClassApi.md#list_assignments) | **GET** /classes/{class}/assignments | Assignments listing -[**list_class_student_submissions**](ClassApi.md#list_class_student_submissions) | **GET** /classes/{class}/students/{user}/submissions | List the submissions for a student -[**list_classes**](ClassApi.md#list_classes) | **GET** /classes | List the classes available for the current user -[**unarchive_class**](ClassApi.md#unarchive_class) | **DELETE** /classes/{class}/archive | Unarchive the class -[**update_class**](ClassApi.md#update_class) | **PUT** /classes/{class} | Update the class - - -# **activate_class** -> ClassDetails activate_class(_class) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class - -try: - # Activate the class - api_response = api_instance.activate_class(_class) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->activate_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **add_class_user** -> add_class_user(_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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -user = 'user_example' # str | Unique identifier of the user - -try: - # Add a user to the class - api_instance.add_class_user(_class, user) -except ApiException as e: - print("Exception when calling ClassApi->add_class_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **user** | **str**| Unique identifier of the user | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **archive_class** -> ClassDetails archive_class(_class) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class - -try: - # Archive the class - api_response = api_instance.archive_class(_class) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->archive_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **copy_assignment** -> Assignment copy_assignment(_class, assignment, body) - -Copy an assignment - -Copy an assignment to a specified class. If the original assignment has a due date in the past, this new assingment will be created without a due date. If the new class is synchronized with an external app (e.g. Google Classroom), the copied assignment will also be posted on the external app. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -assignment = 'assignment_example' # str | Unique identifier of the assignment -body = flat_api.AssignmentCopy() # AssignmentCopy | - -try: - # Copy an assignment - api_response = api_instance.copy_assignment(_class, assignment, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->copy_assignment: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **assignment** | **str**| Unique identifier of the assignment | - **body** | [**AssignmentCopy**](AssignmentCopy.md)| | - -### Return type - -[**Assignment**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_assignment** -> Assignment create_assignment(_class, body=body) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -body = flat_api.AssignmentCreation() # AssignmentCreation | (optional) - -try: - # Assignment creation - api_response = api_instance.create_assignment(_class, body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->create_assignment: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **body** | [**AssignmentCreation**](AssignmentCreation.md)| | [optional] - -### Return type - -[**Assignment**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_class** -> ClassDetails create_class(body) - -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 `POST /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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -body = flat_api.ClassCreation() # ClassCreation | - -try: - # Create a new class - api_response = api_instance.create_class(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->create_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**ClassCreation**](ClassCreation.md)| | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_submission** -> AssignmentSubmission create_submission(_class, assignment, body) - -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`, `studentComment` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -assignment = 'assignment_example' # str | Unique identifier of the assignment -body = flat_api.AssignmentSubmissionUpdate() # AssignmentSubmissionUpdate | - -try: - # Create or edit a submission - api_response = api_instance.create_submission(_class, assignment, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->create_submission: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **assignment** | **str**| Unique identifier of the assignment | - **body** | [**AssignmentSubmissionUpdate**](AssignmentSubmissionUpdate.md)| | - -### Return type - -[**AssignmentSubmission**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **delete_class_user** -> delete_class_user(_class, user) - -Remove a user from the class - -This method can be used by a teacher to remove a user from the class, or by a student to leave the classroom. Warning: Removing a user from the class will remove the associated resources, including the submissions and feedback related to these submissions. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -user = 'user_example' # str | Unique identifier of the user - -try: - # Remove a user from the class - api_instance.delete_class_user(_class, user) -except ApiException as e: - print("Exception when calling ClassApi->delete_class_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **user** | **str**| Unique identifier of the user | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **edit_submission** -> AssignmentSubmission edit_submission(_class, assignment, submission, body) - -Edit a submission - -Use this method as a teacher to update the different submission and give feedback. Teachers can only set `returnFeedback` - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -assignment = 'assignment_example' # str | Unique identifier of the assignment -submission = 'submission_example' # str | Unique identifier of the submission -body = flat_api.AssignmentSubmissionUpdate() # AssignmentSubmissionUpdate | - -try: - # Edit a submission - api_response = api_instance.edit_submission(_class, assignment, submission, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->edit_submission: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **assignment** | **str**| Unique identifier of the assignment | - **submission** | **str**| Unique identifier of the submission | - **body** | [**AssignmentSubmissionUpdate**](AssignmentSubmissionUpdate.md)| | - -### Return type - -[**AssignmentSubmission**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **enroll_class** -> ClassDetails enroll_class(enrollment_code) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -enrollment_code = 'enrollment_code_example' # str | The enrollment code, available to the teacher in `ClassDetails` - -try: - # Join a class - api_response = api_instance.enroll_class(enrollment_code) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->enroll_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enrollment_code** | **str**| The enrollment code, available to the teacher in `ClassDetails` | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_class** -> ClassDetails get_class(_class) - -Get the details of a single class - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class - -try: - # Get the details of a single class - api_response = api_instance.get_class(_class) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->get_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_submissions** -> list[AssignmentSubmission] get_score_submissions(score) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: - # List submissions related to the score - api_response = api_instance.get_score_submissions(score) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->get_score_submissions: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 - -[**list[AssignmentSubmission]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_submission** -> AssignmentSubmission get_submission(_class, assignment, submission) - -Get a student submission - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -assignment = 'assignment_example' # str | Unique identifier of the assignment -submission = 'submission_example' # str | Unique identifier of the submission - -try: - # Get a student submission - api_response = api_instance.get_submission(_class, assignment, submission) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->get_submission: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **assignment** | **str**| Unique identifier of the assignment | - **submission** | **str**| Unique identifier of the submission | - -### Return type - -[**AssignmentSubmission**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_submissions** -> list[AssignmentSubmission] get_submissions(_class, assignment) - -List the students' submissions - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -assignment = 'assignment_example' # str | Unique identifier of the assignment - -try: - # List the students' submissions - api_response = api_instance.get_submissions(_class, assignment) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->get_submissions: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **assignment** | **str**| Unique identifier of the assignment | - -### Return type - -[**list[AssignmentSubmission]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_assignments** -> list[Assignment] list_assignments(_class) - -Assignments listing - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class - -try: - # Assignments listing - api_response = api_instance.list_assignments(_class) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->list_assignments: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - -### Return type - -[**list[Assignment]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_class_student_submissions** -> list[AssignmentSubmission] list_class_student_submissions(_class, user) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -user = 'user_example' # str | Unique identifier of the user - -try: - # List the submissions for a student - api_response = api_instance.list_class_student_submissions(_class, user) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->list_class_student_submissions: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **user** | **str**| Unique identifier of the user | - -### Return type - -[**list[AssignmentSubmission]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_classes** -> list[ClassDetails] list_classes(state=state) - -List the classes available for the current user - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -state = 'active' # str | Filter the classes by state (optional) (default to active) - -try: - # List the classes available for the current user - api_response = api_instance.list_classes(state=state) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->list_classes: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **state** | **str**| Filter the classes by state | [optional] [default to active] - -### Return type - -[**list[ClassDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **unarchive_class** -> ClassDetails unarchive_class(_class) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class - -try: - # Unarchive the class - api_response = api_instance.unarchive_class(_class) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->unarchive_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **update_class** -> ClassDetails update_class(_class, body=body) - -Update the class - -Update the meta information of the class - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ClassApi(flat_api.ApiClient(configuration)) -_class = '_class_example' # str | Unique identifier of the class -body = flat_api.ClassUpdate() # ClassUpdate | Details of the Class (optional) - -try: - # Update the class - api_response = api_instance.update_class(_class, body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ClassApi->update_class: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_class** | **str**| Unique identifier of the class | - **body** | [**ClassUpdate**](ClassUpdate.md)| Details of the Class | [optional] - -### Return type - -[**ClassDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/ClassAttachmentCreation.md b/docs/ClassAttachmentCreation.md deleted file mode 100644 index 924fde7..0000000 --- a/docs/ClassAttachmentCreation.md +++ /dev/null @@ -1,12 +0,0 @@ -# ClassAttachmentCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | The type of the attachment posted | [optional] -**score** | **str** | 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] -**url** | **str** | The URL of the attachment. | [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/ClassCreation.md b/docs/ClassCreation.md deleted file mode 100644 index 8f740c0..0000000 --- a/docs/ClassCreation.md +++ /dev/null @@ -1,11 +0,0 @@ -# ClassCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | The name of the new class | -**section** | **str** | The section of the new class | [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/ClassDetails.md b/docs/ClassDetails.md deleted file mode 100644 index a74a920..0000000 --- a/docs/ClassDetails.md +++ /dev/null @@ -1,27 +0,0 @@ -# ClassDetails - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the class | [optional] -**state** | [**ClassState**](ClassState.md) | | [optional] -**name** | **str** | The name of the class | [optional] -**section** | **str** | The section of the class | [optional] -**description** | **str** | An optionnal description for this class | [optional] -**organization** | **str** | The unique identifier of the Organization owning this class | [optional] -**owner** | **str** | The unique identifier of the User owning this class | [optional] -**creation_date** | **datetime** | The date when the class was create | [optional] -**enrollment_code** | **str** | [Teachers only] The enrollment code that can be used by the students to join the class | [optional] -**theme** | **str** | The theme identifier using in Flat User Interface | [optional] -**assignments_count** | **float** | The number of assignments created in the class | [optional] -**students_group** | [**GroupDetails**](GroupDetails.md) | | [optional] -**teachers_group** | [**GroupDetails**](GroupDetails.md) | | [optional] -**google_classroom** | [**ClassDetailsGoogleClassroom**](ClassDetailsGoogleClassroom.md) | | [optional] -**google_drive** | [**ClassDetailsGoogleDrive**](ClassDetailsGoogleDrive.md) | | [optional] -**lti** | [**ClassDetailsLti**](ClassDetailsLti.md) | | [optional] -**canvas** | [**ClassDetailsCanvas**](ClassDetailsCanvas.md) | | [optional] -**clever** | [**ClassDetailsClever**](ClassDetailsClever.md) | | [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/ClassDetailsCanvas.md b/docs/ClassDetailsCanvas.md deleted file mode 100644 index a48143d..0000000 --- a/docs/ClassDetailsCanvas.md +++ /dev/null @@ -1,11 +0,0 @@ -# ClassDetailsCanvas - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Unique identifier of the course on Canvas | [optional] -**domain** | **str** | Canvas instance domain (e.g. \"canvas.instructure.com\") | [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/ClassDetailsGoogleClassroom.md b/docs/ClassDetailsGoogleClassroom.md deleted file mode 100644 index d0b6482..0000000 --- a/docs/ClassDetailsGoogleClassroom.md +++ /dev/null @@ -1,13 +0,0 @@ -# ClassDetailsGoogleClassroom - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The course identifier on Google Classroom | [optional] -**alternate_link** | **str** | Absolute link to this course in the Classroom web UI | [optional] -**name** | **str** | The name of the course on Google Classroom | [optional] -**section** | **str** | The section of the course 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/ClassDetailsGoogleDrive.md b/docs/ClassDetailsGoogleDrive.md deleted file mode 100644 index 87b7c3c..0000000 --- a/docs/ClassDetailsGoogleDrive.md +++ /dev/null @@ -1,11 +0,0 @@ -# ClassDetailsGoogleDrive - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**teacher_folder_id** | **str** | [Teachers only] The Drive directory identifier of the teachers' folder | [optional] -**teacher_folder_alternate_link** | **str** | [Teachers only] The Drive URL of the teachers' folder | [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/ClassDetailsLti.md b/docs/ClassDetailsLti.md deleted file mode 100644 index dfd3ff4..0000000 --- a/docs/ClassDetailsLti.md +++ /dev/null @@ -1,12 +0,0 @@ -# ClassDetailsLti - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**context_id** | **str** | Unique context identifier provided | [optional] -**context_title** | **str** | Context title | [optional] -**context_label** | **str** | Context label | [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/ClassUpdate.md b/docs/ClassUpdate.md deleted file mode 100644 index b4b539f..0000000 --- a/docs/ClassUpdate.md +++ /dev/null @@ -1,11 +0,0 @@ -# ClassUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | The name of the class | [optional] -**section** | **str** | The section of the class | [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/Collection.md b/docs/Collection.md deleted file mode 100644 index 22f1725..0000000 --- a/docs/Collection.md +++ /dev/null @@ -1,20 +0,0 @@ -# Collection - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Unique identifier of the collection | [optional] -**title** | [**CollectionTitle**](CollectionTitle.md) | | [optional] -**html_url** | **str** | The url where the collection can be viewed in a web browser | [optional] -**type** | [**CollectionType**](CollectionType.md) | | [optional] -**privacy** | [**CollectionPrivacy**](CollectionPrivacy.md) | | [optional] -**sharing_key** | **str** | The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) | [optional] -**app** | **str** | If this directory is dedicated to an app, the unique idenfier of this app | [optional] -**user** | [**UserPublicSummary**](UserPublicSummary.md) | | [optional] -**rights** | [**ResourceRights**](ResourceRights.md) | | [optional] -**collaborators** | [**list[ResourceCollaborator]**](ResourceCollaborator.md) | The list of the collaborators of the collection | [optional] -**capabilities** | [**CollectionCapabilities**](CollectionCapabilities.md) | | [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/CollectionApi.md b/docs/CollectionApi.md deleted file mode 100644 index 094c90b..0000000 --- a/docs/CollectionApi.md +++ /dev/null @@ -1,510 +0,0 @@ -# flat_api.CollectionApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**add_score_to_collection**](CollectionApi.md#add_score_to_collection) | **PUT** /collections/{collection}/scores/{score} | Add a score to the collection -[**create_collection**](CollectionApi.md#create_collection) | **POST** /collections | Create a new collection -[**delete_collection**](CollectionApi.md#delete_collection) | **DELETE** /collections/{collection} | Delete the collection -[**delete_score_from_collection**](CollectionApi.md#delete_score_from_collection) | **DELETE** /collections/{collection}/scores/{score} | Delete a score from the collection -[**edit_collection**](CollectionApi.md#edit_collection) | **PUT** /collections/{collection} | Update a collection's metadata -[**get_collection**](CollectionApi.md#get_collection) | **GET** /collections/{collection} | Get collection details -[**list_collection_scores**](CollectionApi.md#list_collection_scores) | **GET** /collections/{collection}/scores | List the scores contained in a collection -[**list_collections**](CollectionApi.md#list_collections) | **GET** /collections | List the collections -[**untrash_collection**](CollectionApi.md#untrash_collection) | **POST** /collections/{collection}/untrash | Untrash a collection - - -# **add_score_to_collection** -> ScoreDetails add_score_to_collection(collection, score, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) - -try: - # Add a score to the collection - api_response = api_instance.add_score_to_collection(collection, score, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->add_score_to_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 - -[**ScoreDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_collection** -> Collection create_collection(body) - -Create a new collection - -This method will create a new collection and add it to your `root` collection. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -body = flat_api.CollectionCreation() # CollectionCreation | - -try: - # Create a new collection - api_response = api_instance.create_collection(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->create_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**CollectionCreation**](CollectionCreation.md)| | - -### Return type - -[**Collection**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **delete_collection** -> delete_collection(collection) - -Delete the collection - -This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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: - # Delete the collection - api_instance.delete_collection(collection) -except ApiException as e: - print("Exception when calling CollectionApi->delete_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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 | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **delete_score_from_collection** -> delete_score_from_collection(collection, score) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: - # Delete a score from the collection - api_instance.delete_score_from_collection(collection, score) -except ApiException as e: - print("Exception when calling CollectionApi->delete_score_from_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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**: application/json - - **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) - -# **edit_collection** -> Collection edit_collection(collection, body=body) - -Update a collection's metadata - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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_api.CollectionModification() # CollectionModification | (optional) - -try: - # Update a collection's metadata - api_response = api_instance.edit_collection(collection, body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->edit_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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** | [**CollectionModification**](CollectionModification.md)| | [optional] - -### Return type - -[**Collection**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_collection** -> Collection get_collection(collection, sharing_key=sharing_key) - -Get collection details - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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 -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Get collection details - api_response = api_instance.get_collection(collection, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->get_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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 | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**Collection**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_collection_scores** -> list[ScoreDetails] list_collection_scores(collection, sharing_key=sharing_key, sort=sort, direction=direction, limit=limit, next=next, previous=previous) - -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`. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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 -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) -sort = 'sort_example' # str | Sort (optional) -direction = 'direction_example' # str | Sort direction (optional) -limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) -next = 'next_example' # str | 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 = 'previous_example' # str | 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) - -try: - # List the scores contained in a collection - api_response = api_instance.list_collection_scores(collection, sharing_key=sharing_key, sort=sort, direction=direction, limit=limit, next=next, previous=previous) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->list_collection_scores: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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 | - **sharing_key** | **str**| This sharing key must be specified to 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] - **sort** | **str**| Sort | [optional] - **direction** | **str**| Sort direction | [optional] - **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] - **next** | **str**| 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** | **str**| 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 - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_collections** -> list[Collection] list_collections(parent=parent, sort=sort, direction=direction, limit=limit, next=next, previous=previous) - -List the collections - -Use this method to list the user's collections contained in `parent` (by default in the `root` collection). If no sort option is provided, the collections are sorted by `creationDate` `desc`. Note that this method will not include the `parent` collection in the listing. For example, if you need the details of the `root` collection, you can use `GET /v2/collections/root`. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -parent = 'root' # str | 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 = 'sort_example' # str | Sort (optional) -direction = 'direction_example' # str | Sort direction (optional) -limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) -next = 'next_example' # str | 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 = 'previous_example' # str | 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) - -try: - # List the collections - api_response = api_instance.list_collections(parent=parent, sort=sort, direction=direction, limit=limit, next=next, previous=previous) - pprint(api_response) -except ApiException as e: - print("Exception when calling CollectionApi->list_collections: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **parent** | **str**| 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** | **str**| Sort | [optional] - **direction** | **str**| Sort direction | [optional] - **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] - **next** | **str**| 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** | **str**| 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 - -[**list[Collection]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **untrash_collection** -> untrash_collection(collection) - -Untrash a collection - -This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.CollectionApi(flat_api.ApiClient(configuration)) -collection = 'collection_example' # str | 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: - # Untrash a collection - api_instance.untrash_collection(collection) -except ApiException as e: - print("Exception when calling CollectionApi->untrash_collection: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **collection** | **str**| 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 | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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/CollectionCreation.md b/docs/CollectionCreation.md deleted file mode 100644 index 105f60d..0000000 --- a/docs/CollectionCreation.md +++ /dev/null @@ -1,10 +0,0 @@ -# CollectionCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | [**CollectionTitle**](CollectionTitle.md) | | - -[[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/CollectionModification.md b/docs/CollectionModification.md deleted file mode 100644 index db90e40..0000000 --- a/docs/CollectionModification.md +++ /dev/null @@ -1,10 +0,0 @@ -# CollectionModification - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | [**CollectionTitle**](CollectionTitle.md) | | [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/CollectionTitle.md b/docs/CollectionTitle.md deleted file mode 100644 index 89ce5b1..0000000 --- a/docs/CollectionTitle.md +++ /dev/null @@ -1,9 +0,0 @@ -# CollectionTitle - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/CollectionType.md b/docs/CollectionType.md deleted file mode 100644 index 9f6e24a..0000000 --- a/docs/CollectionType.md +++ /dev/null @@ -1,9 +0,0 @@ -# CollectionType - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/FlatErrorResponse.md b/docs/FlatErrorResponse.md deleted file mode 100644 index 6f8d08a..0000000 --- a/docs/FlatErrorResponse.md +++ /dev/null @@ -1,13 +0,0 @@ -# FlatErrorResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **str** | A corresponding code for this error | [optional] -**message** | **str** | A printable message for this message | [optional] -**id** | **str** | An unique error identifier generated for the request | [optional] -**param** | **str** | The related parameter that caused the error | [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/FlatLocales.md b/docs/FlatLocales.md deleted file mode 100644 index 0e35bd3..0000000 --- a/docs/FlatLocales.md +++ /dev/null @@ -1,9 +0,0 @@ -# FlatLocales - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/GoogleClassroomCoursework.md b/docs/GoogleClassroomCoursework.md deleted file mode 100644 index 1fcee5a..0000000 --- a/docs/GoogleClassroomCoursework.md +++ /dev/null @@ -1,12 +0,0 @@ -# GoogleClassroomCoursework - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Identifier of the coursework assigned by Classroom | [optional] -**state** | **str** | State of the coursework | [optional] -**alternate_link** | **str** | Absolute link to this coursework in the Classroom web UI | [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/GoogleClassroomSubmission.md b/docs/GoogleClassroomSubmission.md deleted file mode 100644 index bd70302..0000000 --- a/docs/GoogleClassroomSubmission.md +++ /dev/null @@ -1,12 +0,0 @@ -# GoogleClassroomSubmission - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Identifier of the coursework submission assigned by Classroom | [optional] -**state** | **str** | State of the submission on Google Classroom | [optional] -**alternate_link** | **str** | Absolute link to this coursework in the Classroom web UI | [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/GroupApi.md b/docs/GroupApi.md deleted file mode 100644 index df7ec7c..0000000 --- a/docs/GroupApi.md +++ /dev/null @@ -1,165 +0,0 @@ -# flat_api.GroupApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_group_details**](GroupApi.md#get_group_details) | **GET** /groups/{group} | Get group information -[**get_group_scores**](GroupApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores -[**list_group_users**](GroupApi.md#list_group_users) | **GET** /groups/{group}/users | List group's users - - -# **get_group_details** -> GroupDetails get_group_details(group) - -Get group information - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.GroupApi(flat_api.ApiClient(configuration)) -group = 'group_example' # str | Unique identifier of a Flat group - -try: - # Get group information - api_response = api_instance.get_group_details(group) - pprint(api_response) -except ApiException as e: - print("Exception when calling GroupApi->get_group_details: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **group** | **str**| Unique identifier of a Flat group | - -### Return type - -[**GroupDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_group_scores** -> list[ScoreDetails] get_group_scores(group, parent=parent) - -List group's scores - -Get the list of scores shared with a group. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.GroupApi(flat_api.ApiClient(configuration)) -group = 'group_example' # str | Unique identifier of a Flat group -parent = 'parent_example' # str | Filter the score forked from the score id `parent` (optional) - -try: - # List group's scores - api_response = api_instance.get_group_scores(group, parent=parent) - pprint(api_response) -except ApiException as e: - print("Exception when calling GroupApi->get_group_scores: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **group** | **str**| Unique identifier of a Flat group | - **parent** | **str**| Filter the score forked from the score id `parent` | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_group_users** -> list[UserPublic] list_group_users(group) - -List group's users - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.GroupApi(flat_api.ApiClient(configuration)) -group = 'group_example' # str | Unique identifier of a Flat group - -try: - # List group's users - api_response = api_instance.list_group_users(group) - pprint(api_response) -except ApiException as e: - print("Exception when calling GroupApi->list_group_users: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **group** | **str**| Unique identifier of a Flat group | - -### Return type - -[**list[UserPublic]**](UserPublic.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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/GroupDetails.md b/docs/GroupDetails.md deleted file mode 100644 index f09ca57..0000000 --- a/docs/GroupDetails.md +++ /dev/null @@ -1,16 +0,0 @@ -# GroupDetails - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the group | [optional] -**name** | **str** | The displayable name of the group | [optional] -**type** | [**GroupType**](GroupType.md) | | [optional] -**organization** | **str** | The unique identifier of the Organization owning the group | [optional] -**creation_date** | **datetime** | The date when the group was create | [optional] -**users_count** | **float** | The number of students in this group | [optional] -**read_only** | **bool** | `true` if the properties and members of this group are in in read-only | [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/GroupType.md b/docs/GroupType.md deleted file mode 100644 index 02d2c1c..0000000 --- a/docs/GroupType.md +++ /dev/null @@ -1,9 +0,0 @@ -# GroupType - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/LicenseSources.md b/docs/LicenseSources.md deleted file mode 100644 index f56b568..0000000 --- a/docs/LicenseSources.md +++ /dev/null @@ -1,9 +0,0 @@ -# LicenseSources - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/LmsName.md b/docs/LmsName.md deleted file mode 100644 index 384f372..0000000 --- a/docs/LmsName.md +++ /dev/null @@ -1,9 +0,0 @@ -# LmsName - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/LtiCredentials.md b/docs/LtiCredentials.md deleted file mode 100644 index 06c1662..0000000 --- a/docs/LtiCredentials.md +++ /dev/null @@ -1,18 +0,0 @@ -# LtiCredentials - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of this couple of credentials | [optional] -**name** | **str** | Name of the couple of credentials | [optional] -**lms** | [**LmsName**](LmsName.md) | | [optional] -**organization** | **str** | The unique identifier of the Organization associated to these credentials | [optional] -**creator** | **str** | 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** | **str** | OAuth 1 Consumer Key | [optional] -**consumer_secret** | **str** | OAuth 1 Consumer Secret | [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/LtiCredentialsCreation.md b/docs/LtiCredentialsCreation.md deleted file mode 100644 index cc43b38..0000000 --- a/docs/LtiCredentialsCreation.md +++ /dev/null @@ -1,11 +0,0 @@ -# LtiCredentialsCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | Name of the couple of credentials | -**lms** | [**LmsName**](LmsName.md) | | - -[[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/MediaAttachment.md b/docs/MediaAttachment.md deleted file mode 100644 index 3b188f0..0000000 --- a/docs/MediaAttachment.md +++ /dev/null @@ -1,25 +0,0 @@ -# MediaAttachment - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | 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. | [optional] -**score** | **str** | An unique Flat score identifier | [optional] -**revision** | **str** | An unique revision identifier of a score | [optional] -**correct** | **bool** | If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only. | [optional] -**sharing_mode** | [**MediaScoreSharingMode**](MediaScoreSharingMode.md) | | [optional] -**title** | **str** | The resolved title of the attachment | [optional] -**description** | **str** | The resolved description of the attachment | [optional] -**html** | **str** | If the attachment type is `rich` or `video`, the HTML code of the media to display | [optional] -**html_width** | **str** | If the `html` is available, the width of the widget | [optional] -**html_height** | **str** | If the `html` is available, the height of the widget | [optional] -**url** | **str** | The url of the attachment | [optional] -**thumbnail_url** | **str** | If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment | [optional] -**thumbnail_width** | **str** | If the `thumbnailUrl` is available, the width of the thumbnail | [optional] -**thumbnail_height** | **str** | If the `thumbnailUrl` is available, the width of the thumbnail | [optional] -**author_name** | **str** | The resolved author name of the attachment | [optional] -**author_url** | **str** | The resolved author url of the attachment | [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/MediaScoreSharingMode.md b/docs/MediaScoreSharingMode.md deleted file mode 100644 index 98d7bab..0000000 --- a/docs/MediaScoreSharingMode.md +++ /dev/null @@ -1,9 +0,0 @@ -# MediaScoreSharingMode - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/OrganizationApi.md b/docs/OrganizationApi.md deleted file mode 100644 index 4b2d4c0..0000000 --- a/docs/OrganizationApi.md +++ /dev/null @@ -1,533 +0,0 @@ -# flat_api.OrganizationApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_lti_credentials**](OrganizationApi.md#create_lti_credentials) | **POST** /organizations/lti/credentials | Create a new couple of LTI 1.x credentials -[**create_organization_invitation**](OrganizationApi.md#create_organization_invitation) | **POST** /organizations/invitations | Create a new invitation to join the organization -[**create_organization_user**](OrganizationApi.md#create_organization_user) | **POST** /organizations/users | Create a new user account -[**list_lti_credentials**](OrganizationApi.md#list_lti_credentials) | **GET** /organizations/lti/credentials | List LTI 1.x credentials -[**list_organization_invitations**](OrganizationApi.md#list_organization_invitations) | **GET** /organizations/invitations | List the organization invitations -[**list_organization_users**](OrganizationApi.md#list_organization_users) | **GET** /organizations/users | List the organization users -[**remove_organization_invitation**](OrganizationApi.md#remove_organization_invitation) | **DELETE** /organizations/invitations/{invitation} | Remove an organization invitation -[**remove_organization_user**](OrganizationApi.md#remove_organization_user) | **DELETE** /organizations/users/{user} | Remove an account from Flat -[**revoke_lti_credentials**](OrganizationApi.md#revoke_lti_credentials) | **DELETE** /organizations/lti/credentials/{credentials} | Revoke LTI 1.x credentials -[**update_organization_user**](OrganizationApi.md#update_organization_user) | **PUT** /organizations/users/{user} | Update account information - - -# **create_lti_credentials** -> LtiCredentials create_lti_credentials(body) - -Create a new couple of LTI 1.x credentials - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -body = flat_api.LtiCredentialsCreation() # LtiCredentialsCreation | - -try: - # Create a new couple of LTI 1.x credentials - api_response = api_instance.create_lti_credentials(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->create_lti_credentials: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**LtiCredentialsCreation**](LtiCredentialsCreation.md)| | - -### Return type - -[**LtiCredentials**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_organization_invitation** -> OrganizationInvitation create_organization_invitation(body=body) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -body = flat_api.OrganizationInvitationCreation() # OrganizationInvitationCreation | (optional) - -try: - # Create a new invitation to join the organization - api_response = api_instance.create_organization_invitation(body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->create_organization_invitation: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**OrganizationInvitationCreation**](OrganizationInvitationCreation.md)| | [optional] - -### Return type - -[**OrganizationInvitation**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_organization_user** -> UserDetailsAdmin create_organization_user(body=body) - -Create a new user account - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -body = flat_api.UserCreation() # UserCreation | (optional) - -try: - # Create a new user account - api_response = api_instance.create_organization_user(body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->create_organization_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**UserCreation**](UserCreation.md)| | [optional] - -### Return type - -[**UserDetailsAdmin**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_lti_credentials** -> list[LtiCredentials] list_lti_credentials() - -List LTI 1.x credentials - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) - -try: - # List LTI 1.x credentials - api_response = api_instance.list_lti_credentials() - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->list_lti_credentials: %s\n" % e) -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**list[LtiCredentials]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_organization_invitations** -> list[OrganizationInvitation] list_organization_invitations(role=role, limit=limit, next=next, previous=previous) - -List the organization invitations - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -role = 'role_example' # str | Filter users by role (optional) -limit = 50 # int | This is the maximum number of objects that may be returned (optional) (default to 50) -next = 'next_example' # str | 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 = 'previous_example' # str | 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) - -try: - # List the organization invitations - api_response = api_instance.list_organization_invitations(role=role, limit=limit, next=next, previous=previous) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->list_organization_invitations: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **role** | **str**| Filter users by role | [optional] - **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] - **next** | **str**| 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** | **str**| 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 - -[**list[OrganizationInvitation]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_organization_users** -> list[UserDetailsAdmin] list_organization_users(role=role, limit=limit, next=next, previous=previous) - -List the organization users - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -role = 'role_example' # str | Filter users by role (optional) -limit = 50 # int | This is the maximum number of objects that may be returned (optional) (default to 50) -next = 'next_example' # str | 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 = 'previous_example' # str | 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) - -try: - # List the organization users - api_response = api_instance.list_organization_users(role=role, limit=limit, next=next, previous=previous) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->list_organization_users: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **role** | **str**| Filter users by role | [optional] - **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] - **next** | **str**| 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** | **str**| 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 - -[**list[UserDetailsAdmin]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **remove_organization_invitation** -> remove_organization_invitation(invitation) - -Remove an organization invitation - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -invitation = 'invitation_example' # str | Unique identifier of the invitation - -try: - # Remove an organization invitation - api_instance.remove_organization_invitation(invitation) -except ApiException as e: - print("Exception when calling OrganizationApi->remove_organization_invitation: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **invitation** | **str**| Unique identifier of the invitation | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **remove_organization_user** -> remove_organization_user(user, convert_to_individual=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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | 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. (optional) - -try: - # Remove an account from Flat - api_instance.remove_organization_user(user, convert_to_individual=convert_to_individual) -except ApiException as e: - print("Exception when calling OrganizationApi->remove_organization_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| 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**: application/json - - **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) - -# **revoke_lti_credentials** -> revoke_lti_credentials(credentials) - -Revoke LTI 1.x credentials - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -credentials = 'credentials_example' # str | Credentials unique identifier - -try: - # Revoke LTI 1.x credentials - api_instance.revoke_lti_credentials(credentials) -except ApiException as e: - print("Exception when calling OrganizationApi->revoke_lti_credentials: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **credentials** | **str**| Credentials unique identifier | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **update_organization_user** -> UserDetailsAdmin update_organization_user(user, body) - -Update account information - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.OrganizationApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | Unique identifier of the Flat account -body = flat_api.UserAdminUpdate() # UserAdminUpdate | - -try: - # Update account information - api_response = api_instance.update_organization_user(user, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling OrganizationApi->update_organization_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| Unique identifier of the Flat account | - **body** | [**UserAdminUpdate**](UserAdminUpdate.md)| | - -### Return type - -[**UserDetailsAdmin**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/OrganizationInvitation.md b/docs/OrganizationInvitation.md deleted file mode 100644 index aa01f11..0000000 --- a/docs/OrganizationInvitation.md +++ /dev/null @@ -1,16 +0,0 @@ -# OrganizationInvitation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The invitation unique identifier | [optional] -**organization** | **str** | The unique identifier of the Organization owning this class | [optional] -**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] -**custom_code** | **str** | Enrollment code to use when joining this organization | [optional] -**email** | **str** | The email address this invitation was sent to | [optional] -**invited_by** | **str** | The unique identifier of the User who created this invitation | [optional] -**used_by** | **str** | The unique identifier of the User who used this invitation | [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/OrganizationInvitationCreation.md b/docs/OrganizationInvitationCreation.md deleted file mode 100644 index 338b118..0000000 --- a/docs/OrganizationInvitationCreation.md +++ /dev/null @@ -1,11 +0,0 @@ -# OrganizationInvitationCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **str** | The email address you want to send the invitation to | [optional] -**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [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/OrganizationRoles.md b/docs/OrganizationRoles.md deleted file mode 100644 index 6d49485..0000000 --- a/docs/OrganizationRoles.md +++ /dev/null @@ -1,9 +0,0 @@ -# OrganizationRoles - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ResourceRights.md b/docs/ResourceRights.md deleted file mode 100644 index c92c747..0000000 --- a/docs/ResourceRights.md +++ /dev/null @@ -1,12 +0,0 @@ -# ResourceRights - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**acl_read** | **bool** | `True` if the current user can read the current document | [optional] [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. | [optional] [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. | [optional] [default to False] - -[[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/ResourceSharingKey.md b/docs/ResourceSharingKey.md deleted file mode 100644 index e5f7314..0000000 --- a/docs/ResourceSharingKey.md +++ /dev/null @@ -1,9 +0,0 @@ -# ResourceSharingKey - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ScoreApi.md b/docs/ScoreApi.md deleted file mode 100644 index 7ccf0fb..0000000 --- a/docs/ScoreApi.md +++ /dev/null @@ -1,1602 +0,0 @@ -# flat_api.ScoreApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**add_score_collaborator**](ScoreApi.md#add_score_collaborator) | **POST** /scores/{score}/collaborators | Add a new collaborator -[**add_score_track**](ScoreApi.md#add_score_track) | **POST** /scores/{score}/tracks | Add a new video or audio track to the score -[**create_score**](ScoreApi.md#create_score) | **POST** /scores | Create a new score -[**create_score_revision**](ScoreApi.md#create_score_revision) | **POST** /scores/{score}/revisions | Create a new revision -[**delete_score**](ScoreApi.md#delete_score) | **DELETE** /scores/{score} | Delete a score -[**delete_score_comment**](ScoreApi.md#delete_score_comment) | **DELETE** /scores/{score}/comments/{comment} | Delete a comment -[**delete_score_track**](ScoreApi.md#delete_score_track) | **DELETE** /scores/{score}/tracks/{track} | Remove an audio or video track linked to the score -[**edit_score**](ScoreApi.md#edit_score) | **PUT** /scores/{score} | Edit a score's metadata -[**fork_score**](ScoreApi.md#fork_score) | **POST** /scores/{score}/fork | Fork a score -[**ger_user_likes**](ScoreApi.md#ger_user_likes) | **GET** /users/{user}/likes | List liked scores -[**get_group_scores**](ScoreApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores -[**get_score**](ScoreApi.md#get_score) | **GET** /scores/{score} | Get a score's metadata -[**get_score_collaborator**](ScoreApi.md#get_score_collaborator) | **GET** /scores/{score}/collaborators/{collaborator} | Get a collaborator -[**get_score_collaborators**](ScoreApi.md#get_score_collaborators) | **GET** /scores/{score}/collaborators | List the collaborators -[**get_score_comments**](ScoreApi.md#get_score_comments) | **GET** /scores/{score}/comments | List comments -[**get_score_revision**](ScoreApi.md#get_score_revision) | **GET** /scores/{score}/revisions/{revision} | Get a score revision -[**get_score_revision_data**](ScoreApi.md#get_score_revision_data) | **GET** /scores/{score}/revisions/{revision}/{format} | Get a score revision data -[**get_score_revisions**](ScoreApi.md#get_score_revisions) | **GET** /scores/{score}/revisions | List the revisions -[**get_score_submissions**](ScoreApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score -[**get_score_track**](ScoreApi.md#get_score_track) | **GET** /scores/{score}/tracks/{track} | Retrieve the details of an audio or video track linked to a score -[**get_user_scores**](ScoreApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores -[**list_score_tracks**](ScoreApi.md#list_score_tracks) | **GET** /scores/{score}/tracks | List the audio or video tracks linked to a score -[**mark_score_comment_resolved**](ScoreApi.md#mark_score_comment_resolved) | **PUT** /scores/{score}/comments/{comment}/resolved | Mark the comment as resolved -[**mark_score_comment_unresolved**](ScoreApi.md#mark_score_comment_unresolved) | **DELETE** /scores/{score}/comments/{comment}/resolved | Mark the comment as unresolved -[**post_score_comment**](ScoreApi.md#post_score_comment) | **POST** /scores/{score}/comments | Post a new comment -[**remove_score_collaborator**](ScoreApi.md#remove_score_collaborator) | **DELETE** /scores/{score}/collaborators/{collaborator} | Delete a collaborator -[**untrash_score**](ScoreApi.md#untrash_score) | **POST** /scores/{score}/untrash | Untrash a score -[**update_score_comment**](ScoreApi.md#update_score_comment) | **PUT** /scores/{score}/comments/{comment} | Update an existing comment -[**update_score_track**](ScoreApi.md#update_score_track) | **PUT** /scores/{score}/tracks/{track} | Update an audio or video track linked to a score - - -# **add_score_collaborator** -> ResourceCollaborator add_score_collaborator(score, body) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ResourceCollaboratorCreation() # ResourceCollaboratorCreation | - -try: - # Add a new collaborator - api_response = api_instance.add_score_collaborator(score, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->add_score_collaborator: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ResourceCollaboratorCreation**](ResourceCollaboratorCreation.md)| | - -### Return type - -[**ResourceCollaborator**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **add_score_track** -> ScoreTrack add_score_track(score, body) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreTrackCreation() # ScoreTrackCreation | - -try: - # Add a new video or audio track to the score - api_response = api_instance.add_score_track(score, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->add_score_track: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreTrackCreation**](ScoreTrackCreation.md)| | - -### Return type - -[**ScoreTrack**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_score** -> ScoreDetails create_score(body) - -Create a new score - -Use this API method to **create a new music score in the current User account**. You will need a MusicXML 3 (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`) or a MIDI (`audio/midi`) file to create the new Flat document. 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. This can be the `root` collection or a different collection based on the user's settings or API authentication method. 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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -body = flat_api.ScoreCreation() # ScoreCreation | - -try: - # Create a new score - api_response = api_instance.create_score(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->create_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**ScoreCreation**](ScoreCreation.md)| | - -### Return type - -[**ScoreDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **create_score_revision** -> ScoreRevision create_score_revision(score, body) - -Create a new revision - -Update a score by uploading a new revision for this one. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreRevisionCreation() # ScoreRevisionCreation | - -try: - # Create a new revision - api_response = api_instance.create_score_revision(score, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->create_score_revision: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreRevisionCreation**](ScoreRevisionCreation.md)| | - -### Return type - -[**ScoreRevision**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **delete_score** -> delete_score(score) - -Delete a score - -This method can be used by the owner/admin (`aclAdmin` rights) of a score as well as regular collaborators. 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 regular collaborator (`aclRead` / `aclWrite`), the score will be unshared (i.e. removed from the account & own collections). - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: - # Delete a score - api_instance.delete_score(score) -except ApiException as e: - print("Exception when calling ScoreApi->delete_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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**: application/json - - **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) - -# **delete_score_comment** -> delete_score_comment(score, comment, sharing_key=sharing_key) - -Delete a comment - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Delete a comment - api_instance.delete_score_comment(score, comment, sharing_key=sharing_key) -except ApiException as e: - print("Exception when calling ScoreApi->delete_score_comment: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | - **sharing_key** | **str**| This sharing key must be specified to 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/json - - **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) - -# **delete_score_track** -> delete_score_track(score, track) - -Remove an audio or video track linked to the score - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track - -try: - # Remove an audio or video track linked to the score - api_instance.delete_score_track(score, track) -except ApiException as e: - print("Exception when calling ScoreApi->delete_score_track: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score audio track | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **edit_score** -> ScoreDetails edit_score(score, body=body) - -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` of the score, the API metadata are updated directly when calling this method, unlike the data itself. The title in the score data will be \"lazy\" updated at the next score save with the editor or our internal save. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreModification() # ScoreModification | (optional) - -try: - # Edit a score's metadata - api_response = api_instance.edit_score(score, body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->edit_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreModification**](ScoreModification.md)| | [optional] - -### Return type - -[**ScoreDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **fork_score** -> ScoreDetails fork_score(score, body, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreFork() # ScoreFork | -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Fork a score - api_response = api_instance.fork_score(score, body, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->fork_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreFork**](ScoreFork.md)| | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ScoreDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **ger_user_likes** -> list[ScoreDetails] ger_user_likes(user, ids=ids) - -List liked scores - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | 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 (optional) - -try: - # List liked scores - api_response = api_instance.ger_user_likes(user, ids=ids) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->ger_user_likes: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | - **ids** | **bool**| Return only the identifiers of the scores | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_group_scores** -> list[ScoreDetails] get_group_scores(group, parent=parent) - -List group's scores - -Get the list of scores shared with a group. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -group = 'group_example' # str | Unique identifier of a Flat group -parent = 'parent_example' # str | Filter the score forked from the score id `parent` (optional) - -try: - # List group's scores - api_response = api_instance.get_group_scores(group, parent=parent) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_group_scores: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **group** | **str**| Unique identifier of a Flat group | - **parent** | **str**| Filter the score forked from the score id `parent` | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score** -> ScoreDetails get_score(score, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) - -try: - # Get a score's metadata - api_response = api_instance.get_score(score, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 - -[**ScoreDetails**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_collaborator** -> ResourceCollaborator get_score_collaborator(score, collaborator, sharing_key=sharing_key) - -Get a collaborator - -Get the information about a collaborator (User or Group). - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Get a collaborator - api_response = api_instance.get_score_collaborator(score, collaborator, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_collaborator: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ResourceCollaborator**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_collaborators** -> list[ResourceCollaborator] get_score_collaborators(score, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) - -try: - # List the collaborators - api_response = api_instance.get_score_collaborators(score, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_collaborators: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 - -[**list[ResourceCollaborator]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_comments** -> list[ScoreComment] get_score_comments(score, sharing_key=sharing_key, type=type, sort=sort, direction=direction) - -List comments - -This method lists the different comments added on a music score (documents and inline) sorted by their post dates. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) -type = 'type_example' # str | Filter the comments by type (optional) -sort = 'sort_example' # str | Sort (optional) -direction = 'direction_example' # str | Sort direction (optional) - -try: - # List comments - api_response = api_instance.get_score_comments(score, sharing_key=sharing_key, type=type, sort=sort, direction=direction) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_comments: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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] - **type** | **str**| Filter the comments by type | [optional] - **sort** | **str**| Sort | [optional] - **direction** | **str**| Sort direction | [optional] - -### Return type - -[**list[ScoreComment]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_revision** -> ScoreRevision get_score_revision(score, revision, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | 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' # str | This sharing key must be specified to 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) - -try: - # Get a score revision - api_response = api_instance.get_score_revision(score, revision, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_revision: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ScoreRevision**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_revision_data** -> str get_score_revision_data(score, revision, format, sharing_key=sharing_key, parts=parts, only_cached=only_cached) - -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`, MP3 `mp3`, WAV `wav`, MIDI `midi`, or a tumbnail of the first page `thumbnail.png`). - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. -format = 'format_example' # str | The format of the file you will retrieve -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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 = 'parts_example' # str | 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) -only_cached = 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 (optional) - -try: - # Get a score revision data - api_response = api_instance.get_score_revision_data(score, revision, format, sharing_key=sharing_key, parts=parts, only_cached=only_cached) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_revision_data: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | - **format** | **str**| The format of the file you will retrieve | - **sharing_key** | **str**| This sharing key must be specified to 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** | **str**| 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] - **only_cached** | **bool**| Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned | [optional] - -### Return type - -**str** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **get_score_revisions** -> list[ScoreRevision] get_score_revisions(score, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) - -try: - # List the revisions - api_response = api_instance.get_score_revisions(score, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_revisions: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 - -[**list[ScoreRevision]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_submissions** -> list[AssignmentSubmission] get_score_submissions(score) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: - # List submissions related to the score - api_response = api_instance.get_score_submissions(score) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_submissions: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 - -[**list[AssignmentSubmission]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_score_track** -> ScoreTrack get_score_track(score, track, sharing_key=sharing_key) - -Retrieve the details of an audio or video track linked to a score - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Retrieve the details of an audio or video track linked to a score - api_response = api_instance.get_score_track(score, track, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_score_track: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score audio track | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ScoreTrack**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_user_scores** -> list[ScoreDetails] get_user_scores(user, parent=parent) - -List user's scores - -Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -parent = 'parent_example' # str | Filter the score forked from the score id `parent` (optional) - -try: - # List user's scores - api_response = api_instance.get_user_scores(user, parent=parent) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->get_user_scores: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | - **parent** | **str**| Filter the score forked from the score id `parent` | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_score_tracks** -> list[ScoreTrack] list_score_tracks(score, sharing_key=sharing_key) - -List the audio or video tracks linked to a score - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) - -try: - # List the audio or video tracks linked to a score - api_response = api_instance.list_score_tracks(score, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->list_score_tracks: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 - -[**list[ScoreTrack]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **mark_score_comment_resolved** -> mark_score_comment_resolved(score, comment, sharing_key=sharing_key) - -Mark the comment as resolved - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Mark the comment as resolved - api_instance.mark_score_comment_resolved(score, comment, sharing_key=sharing_key) -except ApiException as e: - print("Exception when calling ScoreApi->mark_score_comment_resolved: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | - **sharing_key** | **str**| This sharing key must be specified to 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/json - - **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) - -# **mark_score_comment_unresolved** -> mark_score_comment_unresolved(score, comment, sharing_key=sharing_key) - -Mark the comment as unresolved - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Mark the comment as unresolved - api_instance.mark_score_comment_unresolved(score, comment, sharing_key=sharing_key) -except ApiException as e: - print("Exception when calling ScoreApi->mark_score_comment_unresolved: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | - **sharing_key** | **str**| This sharing key must be specified to 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/json - - **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) - -# **post_score_comment** -> ScoreComment post_score_comment(score, body, sharing_key=sharing_key) - -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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreCommentCreation() # ScoreCommentCreation | -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Post a new comment - api_response = api_instance.post_score_comment(score, body, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->post_score_comment: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreCommentCreation**](ScoreCommentCreation.md)| | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ScoreComment**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **remove_score_collaborator** -> remove_score_collaborator(score, collaborator) - -Delete a collaborator - -Remove the specified collaborator from the score - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** - -try: - # Delete a collaborator - api_instance.remove_score_collaborator(score, collaborator) -except ApiException as e: - print("Exception when calling ScoreApi->remove_score_collaborator: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | - -### Return type - -void (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **untrash_score** -> untrash_score(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 -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# create an instance of the API class -api_instance = flat_api.ScoreApi() -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: - # Untrash a score - api_instance.untrash_score(score) -except ApiException as e: - print("Exception when calling ScoreApi->untrash_score: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **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) - -# **update_score_comment** -> ScoreComment update_score_comment(score, comment, body, sharing_key=sharing_key) - -Update an existing comment - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment -body = flat_api.ScoreCommentUpdate() # ScoreCommentUpdate | -sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) - -try: - # Update an existing comment - api_response = api_instance.update_score_comment(score, comment, body, sharing_key=sharing_key) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->update_score_comment: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | - **body** | [**ScoreCommentUpdate**](ScoreCommentUpdate.md)| | - **sharing_key** | **str**| This sharing key must be specified to 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 - -[**ScoreComment**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **update_score_track** -> ScoreTrack update_score_track(score, track, body) - -Update an audio or video track linked to a score - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.ScoreApi(flat_api.ApiClient(configuration)) -score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track -body = flat_api.ScoreTrackUpdate() # ScoreTrackUpdate | - -try: - # Update an audio or video track linked to a score - api_response = api_instance.update_score_track(score, track, body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ScoreApi->update_score_track: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score audio track | - **body** | [**ScoreTrackUpdate**](ScoreTrackUpdate.md)| | - -### Return type - -[**ScoreTrack**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/ScoreCollaborator.md b/docs/ScoreCollaborator.md deleted file mode 100644 index efaf2f1..0000000 --- a/docs/ScoreCollaborator.md +++ /dev/null @@ -1,17 +0,0 @@ -# ScoreCollaborator - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the score permission | [optional] -**score** | **str** | The unique identifier of the score | [optional] -**user** | [**UserPublic**](UserPublic.md) | | [optional] -**group** | [**Group**](Group.md) | | [optional] -**user_email** | **str** | If the collaborator is not a user of Flat yet, this field will contain his email. | [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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreCollaboratorCreation.md b/docs/ScoreCollaboratorCreation.md deleted file mode 100644 index 0cfe031..0000000 --- a/docs/ScoreCollaboratorCreation.md +++ /dev/null @@ -1,15 +0,0 @@ -# ScoreCollaboratorCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**user** | **str** | The unique identifier of a Flat user | [optional] -**group** | **str** | The unique identifier of a Flat group | [optional] -**user_email** | **str** | Fill this field to invite an individual user by email. | [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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreComment.md b/docs/ScoreComment.md deleted file mode 100644 index 7fd20e3..0000000 --- a/docs/ScoreComment.md +++ /dev/null @@ -1,24 +0,0 @@ -# ScoreComment - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The comment unique identifier | [optional] -**type** | **str** | The type of the comment | [optional] -**user** | **str** | The author unique identifier | [optional] -**score** | **str** | The unique identifier of the score where the comment was posted | [optional] -**revision** | **str** | The unique identifier of revision the comment was posted | [optional] -**reply_to** | **str** | 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 | [optional] -**modification_date** | **datetime** | The date of the last comment modification | [optional] -**comment** | **str** | The comment text that can includes mentions using the following format: `@[id:username]`. | [optional] -**raw_comment** | **str** | A raw version of the comment, that can be displayed without parsing the mentions. | [optional] -**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [optional] -**mentions** | **list[str]** | 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** | **str** | If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved | [optional] -**spam** | **bool** | `true if the message has been detected as spam and hidden from other users | [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/ScoreCommentContext.md b/docs/ScoreCommentContext.md deleted file mode 100644 index 851994d..0000000 --- a/docs/ScoreCommentContext.md +++ /dev/null @@ -1,16 +0,0 @@ -# ScoreCommentContext - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**part_uuid** | **str** | The unique identifier (UUID) of the score part | -**staff_idx** | **float** | The identififer of the staff | -**measure_uuids** | **list[str]** | 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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreCommentCreation.md b/docs/ScoreCommentCreation.md deleted file mode 100644 index df97b0a..0000000 --- a/docs/ScoreCommentCreation.md +++ /dev/null @@ -1,15 +0,0 @@ -# ScoreCommentCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**revision** | **str** | 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. | [optional] -**comment** | **str** | The comment text that can includes mentions using the following format: `@[id:username]`. | -**raw_comment** | **str** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] -**mentions** | **list[str]** | The list of user identifiers mentioned in this comment | [optional] -**reply_to** | **str** | When the comment is a reply to another comment, the unique identifier of the parent comment | [optional] -**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [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/ScoreCommentUpdate.md b/docs/ScoreCommentUpdate.md deleted file mode 100644 index ed69050..0000000 --- a/docs/ScoreCommentUpdate.md +++ /dev/null @@ -1,13 +0,0 @@ -# ScoreCommentUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**revision** | **str** | 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. | [optional] -**comment** | **str** | The comment text that can includes mentions using the following format: `@[id:username]`. | [optional] -**raw_comment** | **str** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] -**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [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/ScoreCommentsCounts.md b/docs/ScoreCommentsCounts.md deleted file mode 100644 index a95e24d..0000000 --- a/docs/ScoreCommentsCounts.md +++ /dev/null @@ -1,13 +0,0 @@ -# ScoreCommentsCounts - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**total** | **float** | The total number of comments added on the score | [optional] -**unique** | **float** | The unique (1/user) number of comments added on the score | [optional] -**weekly** | **float** | The weekly unique number of comments added on the score | [optional] -**monthly** | **float** | The monthly unique number of comments added on the 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/ScoreCreation.md b/docs/ScoreCreation.md deleted file mode 100644 index 91616db..0000000 --- a/docs/ScoreCreation.md +++ /dev/null @@ -1,16 +0,0 @@ -# ScoreCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | -**data** | [**ScoreData**](ScoreData.md) | | [optional] -**data_encoding** | [**ScoreDataEncoding**](ScoreDataEncoding.md) | | [optional] -**source** | [**ScoreSource**](ScoreSource.md) | | [optional] -**collection** | **str** | 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] -**google_drive_folder** | **str** | 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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreData.md b/docs/ScoreData.md deleted file mode 100644 index 4dc7983..0000000 --- a/docs/ScoreData.md +++ /dev/null @@ -1,9 +0,0 @@ -# ScoreData - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ScoreDataEncoding.md b/docs/ScoreDataEncoding.md deleted file mode 100644 index a003c65..0000000 --- a/docs/ScoreDataEncoding.md +++ /dev/null @@ -1,9 +0,0 @@ -# ScoreDataEncoding - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ScoreDetails.md b/docs/ScoreDetails.md deleted file mode 100644 index 8e4f00d..0000000 --- a/docs/ScoreDetails.md +++ /dev/null @@ -1,38 +0,0 @@ -# ScoreDetails - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the score | [optional] -**sharing_key** | **str** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] -**title** | **str** | The title of the score | [optional] -**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] -**user** | [**UserPublicSummary**](UserPublicSummary.md) | | [optional] -**html_url** | **str** | The url where the score can be viewed in a web browser | [optional] -**subtitle** | **str** | Subtitle of the score | [optional] -**lyricist** | **str** | Lyricist of the score | [optional] -**composer** | **str** | Composer of the score | [optional] -**description** | **str** | Description of the creation | [optional] -**tags** | **list[str]** | Tags describing the score | [optional] -**creation_type** | [**ScoreCreationType**](ScoreCreationType.md) | | [optional] -**license** | [**ScoreLicense**](ScoreLicense.md) | | [optional] -**license_text** | **str** | Additional license text written on the exported/printed score | [optional] -**duration_time** | **int** | In seconds, an approximative duration of the score | [optional] -**number_measures** | **int** | The number of measures in the score | [optional] -**main_tempo_qpm** | **int** | The main tempo of the score (in QPM) | [optional] -**rights** | [**ResourceRights**](ResourceRights.md) | | [optional] -**collaborators** | [**list[ResourceCollaborator]**](ResourceCollaborator.md) | The list of the collaborators of the score | [optional] -**creation_date** | **datetime** | The date when the score was created | [optional] -**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] -**organization** | **str** | 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** | **str** | If the score has been forked, the unique identifier of the parent score. | [optional] -**instruments** | **list[str]** | 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}`. | [optional] -**google_drive_file_id** | **str** | 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** | [**ScoreLikesCounts**](ScoreLikesCounts.md) | | [optional] -**comments** | [**ScoreCommentsCounts**](ScoreCommentsCounts.md) | | [optional] -**views** | [**ScoreViewsCounts**](ScoreViewsCounts.md) | | [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/ScoreFork.md b/docs/ScoreFork.md deleted file mode 100644 index e353622..0000000 --- a/docs/ScoreFork.md +++ /dev/null @@ -1,10 +0,0 @@ -# ScoreFork - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**collection** | **str** | 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. | [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/ScoreLicense.md b/docs/ScoreLicense.md deleted file mode 100644 index a0fa12e..0000000 --- a/docs/ScoreLicense.md +++ /dev/null @@ -1,9 +0,0 @@ -# ScoreLicense - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ScoreLikesCounts.md b/docs/ScoreLikesCounts.md deleted file mode 100644 index ca874bd..0000000 --- a/docs/ScoreLikesCounts.md +++ /dev/null @@ -1,12 +0,0 @@ -# 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] - -[[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/ScoreModification.md b/docs/ScoreModification.md deleted file mode 100644 index 6860f41..0000000 --- a/docs/ScoreModification.md +++ /dev/null @@ -1,16 +0,0 @@ -# ScoreModification - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **str** | The title of the score | [optional] -**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] -**sharing_key** | [**ResourceSharingKey**](ResourceSharingKey.md) | | [optional] -**description** | **str** | Description of the creation | [optional] -**tags** | **list[str]** | Tags describing the score | [optional] -**creation_type** | [**ScoreCreationType**](ScoreCreationType.md) | | [optional] -**license** | [**ScoreLicense**](ScoreLicense.md) | | [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/ScorePrivacy.md b/docs/ScorePrivacy.md deleted file mode 100644 index 4f9dd0e..0000000 --- a/docs/ScorePrivacy.md +++ /dev/null @@ -1,9 +0,0 @@ -# ScorePrivacy - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/ScoreRevision.md b/docs/ScoreRevision.md deleted file mode 100644 index d9e2a78..0000000 --- a/docs/ScoreRevision.md +++ /dev/null @@ -1,16 +0,0 @@ -# ScoreRevision - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the revision. | [optional] -**user** | **str** | The user identifier who created the revision | [optional] -**collaborators** | **list[str]** | | [optional] -**creation_date** | **datetime** | The date when this revision was created | [optional] -**description** | **str** | 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** | [**ScoreRevisionStatistics**](ScoreRevisionStatistics.md) | | [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/ScoreRevisionCreation.md b/docs/ScoreRevisionCreation.md deleted file mode 100644 index d64e22f..0000000 --- a/docs/ScoreRevisionCreation.md +++ /dev/null @@ -1,13 +0,0 @@ -# ScoreRevisionCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**ScoreData**](ScoreData.md) | | -**data_encoding** | [**ScoreDataEncoding**](ScoreDataEncoding.md) | | [optional] -**autosave** | **bool** | Must be set to `true` if the revision was created automatically. | [optional] -**description** | **str** | A description associated to the revision | [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/ScoreRevisionStatistics.md b/docs/ScoreRevisionStatistics.md deleted file mode 100644 index 81a336c..0000000 --- a/docs/ScoreRevisionStatistics.md +++ /dev/null @@ -1,11 +0,0 @@ -# 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] - -[[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/ScoreRights.md b/docs/ScoreRights.md deleted file mode 100644 index 7d5624f..0000000 --- a/docs/ScoreRights.md +++ /dev/null @@ -1,11 +0,0 @@ -# ScoreRights - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**acl_write** | **bool** | `True` if the current user can modify the current document | [optional] [default to False] -**acl_admin** | **bool** | `True` if the current user 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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreSource.md b/docs/ScoreSource.md deleted file mode 100644 index 181250c..0000000 --- a/docs/ScoreSource.md +++ /dev/null @@ -1,10 +0,0 @@ -# ScoreSource - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**google_drive** | **str** | 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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ScoreSummary.md b/docs/ScoreSummary.md deleted file mode 100644 index ce27beb..0000000 --- a/docs/ScoreSummary.md +++ /dev/null @@ -1,15 +0,0 @@ -# ScoreSummary - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the score | [optional] -**sharing_key** | **str** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] -**title** | **str** | The title of the score | [optional] -**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] -**user** | [**UserPublicSummary**](UserPublicSummary.md) | | [optional] -**html_url** | **str** | The url where the score can be viewed in a web browser | [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/ScoreTrack.md b/docs/ScoreTrack.md deleted file mode 100644 index abbae1d..0000000 --- a/docs/ScoreTrack.md +++ /dev/null @@ -1,21 +0,0 @@ -# ScoreTrack - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The unique identifier of the score track | [optional] -**title** | **str** | Title of the track | [optional] -**score** | **str** | The unique identifier of the score | [optional] -**creator** | **str** | The unique identifier of the track creator | [optional] -**creation_date** | **datetime** | The creation date of the track | [optional] -**modification_date** | **datetime** | The modification date of the track | [optional] -**default** | **bool** | True if the track should be used as default audio source | [optional] -**state** | [**ScoreTrackState**](ScoreTrackState.md) | | [optional] -**type** | [**ScoreTrackType**](ScoreTrackType.md) | | [optional] -**url** | **str** | The URL of the track | [optional] -**media_id** | **str** | 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** | [**list[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [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/ScoreTrackCreation.md b/docs/ScoreTrackCreation.md deleted file mode 100644 index 1000486..0000000 --- a/docs/ScoreTrackCreation.md +++ /dev/null @@ -1,14 +0,0 @@ -# ScoreTrackCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **str** | Title of the track | [optional] -**default** | **bool** | True if the track should be used as default audio source | [optional] -**state** | [**ScoreTrackState**](ScoreTrackState.md) | | [optional] -**url** | **str** | The URL of the track | [optional] -**synchronization_points** | [**list[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [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/ScoreTrackPoint.md b/docs/ScoreTrackPoint.md deleted file mode 100644 index fe021b9..0000000 --- a/docs/ScoreTrackPoint.md +++ /dev/null @@ -1,12 +0,0 @@ -# ScoreTrackPoint - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` | -**measure_uuid** | **str** | The measure unique identifier | [optional] -**time** | **float** | The corresponding time in seconds | - -[[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/ScoreTrackUpdate.md b/docs/ScoreTrackUpdate.md deleted file mode 100644 index 44bb417..0000000 --- a/docs/ScoreTrackUpdate.md +++ /dev/null @@ -1,13 +0,0 @@ -# ScoreTrackUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **str** | Title of the track | [optional] -**default** | **bool** | True if the track should be used as default audio source | [optional] -**state** | [**ScoreTrackState**](ScoreTrackState.md) | | [optional] -**synchronization_points** | [**list[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [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/ScoreViewsCounts.md b/docs/ScoreViewsCounts.md deleted file mode 100644 index bc9d3fb..0000000 --- a/docs/ScoreViewsCounts.md +++ /dev/null @@ -1,12 +0,0 @@ -# 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] - -[[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/UserAdminUpdate.md b/docs/UserAdminUpdate.md deleted file mode 100644 index 9b997ec..0000000 --- a/docs/UserAdminUpdate.md +++ /dev/null @@ -1,11 +0,0 @@ -# UserAdminUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**password** | **str** | Password of the new account | [optional] -**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [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/UserApi.md b/docs/UserApi.md deleted file mode 100644 index aeb90dd..0000000 --- a/docs/UserApi.md +++ /dev/null @@ -1,169 +0,0 @@ -# flat_api.UserApi - -All URIs are relative to *https://api.flat.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**ger_user_likes**](UserApi.md#ger_user_likes) | **GET** /users/{user}/likes | List liked scores -[**get_user**](UserApi.md#get_user) | **GET** /users/{user} | Get a public user profile -[**get_user_scores**](UserApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores - - -# **ger_user_likes** -> list[ScoreDetails] ger_user_likes(user, ids=ids) - -List liked scores - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.UserApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | 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 (optional) - -try: - # List liked scores - api_response = api_instance.ger_user_likes(user, ids=ids) - pprint(api_response) -except ApiException as e: - print("Exception when calling UserApi->ger_user_likes: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | - **ids** | **bool**| Return only the identifiers of the scores | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_user** -> UserPublic get_user(user) - -Get a public user profile - -Get a public profile of a Flat User. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.UserApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | 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: - # Get a public user profile - api_response = api_instance.get_user(user) - pprint(api_response) -except ApiException as e: - print("Exception when calling UserApi->get_user: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| 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 - -[**UserPublic**](UserPublic.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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_user_scores** -> list[ScoreDetails] get_user_scores(user, parent=parent) - -List user's scores - -Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. - -### Example -```python -from __future__ import print_function -import time -import flat_api -from flat_api.rest import ApiException -from pprint import pprint - -# Configure OAuth2 access token for authorization: OAuth2 -configuration = flat_api.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - -# create an instance of the API class -api_instance = flat_api.UserApi(flat_api.ApiClient(configuration)) -user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. -parent = 'parent_example' # str | Filter the score forked from the score id `parent` (optional) - -try: - # List user's scores - api_response = api_instance.get_user_scores(user, parent=parent) - pprint(api_response) -except ApiException as e: - print("Exception when calling UserApi->get_user_scores: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | - **parent** | **str**| Filter the score forked from the score id `parent` | [optional] - -### Return type - -[**list[ScoreDetails]**](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#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/docs/UserBasics.md b/docs/UserBasics.md deleted file mode 100644 index 6990811..0000000 --- a/docs/UserBasics.md +++ /dev/null @@ -1,15 +0,0 @@ -# UserBasics - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | The user unique identifier | [optional] -**username** | **str** | The user name (unique for the organization) | [optional] -**name** | **str** | A displayable name for the user | [optional] -**printable_name** | **str** | The name that can be directly printed (name or username) | [optional] -**picture** | **str** | User pictue | [optional] -**is_power_user** | **bool** | User license status. 'True' if user is an individual Power 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/UserCreation.md b/docs/UserCreation.md deleted file mode 100644 index 32c7e31..0000000 --- a/docs/UserCreation.md +++ /dev/null @@ -1,13 +0,0 @@ -# UserCreation - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**username** | **str** | Username of the new account | -**email** | **str** | Email of the new account | [optional] -**password** | **str** | Password of the new account | -**locale** | [**FlatLocales**](FlatLocales.md) | | [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/UserDetails.md b/docs/UserDetails.md deleted file mode 100644 index 5bb4826..0000000 --- a/docs/UserDetails.md +++ /dev/null @@ -1,13 +0,0 @@ -# UserDetails - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Identifier of the user | [optional] -**type** | **str** | The type of account | [optional] -**private_profile** | **bool** | Tell either this user profile is private or not (individual accounts only) | [optional] -**locale** | [**FlatLocales**](FlatLocales.md) | | [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/UserDetailsAdmin.md b/docs/UserDetailsAdmin.md deleted file mode 100644 index 89837aa..0000000 --- a/docs/UserDetailsAdmin.md +++ /dev/null @@ -1,12 +0,0 @@ -# UserDetailsAdmin - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **str** | Email of the user | [optional] -**last_activity_date** | **datetime** | Date of the last user activity | [optional] -**license** | [**UserDetailsAdminLicense**](UserDetailsAdminLicense.md) | | [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/UserDetailsAdminLicense.md b/docs/UserDetailsAdminLicense.md deleted file mode 100644 index 23d7e45..0000000 --- a/docs/UserDetailsAdminLicense.md +++ /dev/null @@ -1,14 +0,0 @@ -# UserDetailsAdminLicense - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | ID of the current license | [optional] -**expiration_date** | **datetime** | Date when the license expires | [optional] -**source** | [**LicenseSources**](LicenseSources.md) | | [optional] -**mode** | [**LicenseMode**](LicenseMode.md) | | [optional] -**active** | **bool** | ID of the current license | [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/UserInstruments.md b/docs/UserInstruments.md deleted file mode 100644 index b018875..0000000 --- a/docs/UserInstruments.md +++ /dev/null @@ -1,9 +0,0 @@ -# UserInstruments - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/UserPublic.md b/docs/UserPublic.md deleted file mode 100644 index 7a1f4b8..0000000 --- a/docs/UserPublic.md +++ /dev/null @@ -1,17 +0,0 @@ -# UserPublic - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bio** | **str** | 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] -**profile_theme** | **str** | Theme (background) for the profile | [optional] -**instruments** | [**UserInstruments**](UserInstruments.md) | | [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/UserPublicSummary.md b/docs/UserPublicSummary.md deleted file mode 100644 index 345b075..0000000 --- a/docs/UserPublicSummary.md +++ /dev/null @@ -1,13 +0,0 @@ -# UserPublicSummary - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**organization** | **str** | Organization ID (for Edu users only) | [optional] -**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] -**class_role** | [**ClassRoles**](ClassRoles.md) | | [optional] -**html_url** | **str** | Link to user profile (for Indiv. users only) | [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/AccountApi.md b/docs/reference/AccountApi.md new file mode 100644 index 0000000..d18e50a --- /dev/null +++ b/docs/reference/AccountApi.md @@ -0,0 +1,86 @@ +# flat_api.AccountApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_authenticated_user**](AccountApi.md#get_authenticated_user) | **GET** /me | Get current user account + + +# **get_authenticated_user** +> UserDetails get_authenticated_user(only_id=only_id) + +Get current user account + +Get details about the current authenticated User. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_details import UserDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.AccountApi(api_client) + only_id = False # bool | Only return the user id (optional) (default to False) + + try: + # Get current user account + api_response = api_instance.get_authenticated_user(only_id=only_id) + print("The response of AccountApi->get_authenticated_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->get_authenticated_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **only_id** | **bool**| Only return the user id | [optional] [default to False] + +### Return type + +[**UserDetails**](UserDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Current user details | - | +**0** | Error | - | + +[[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/reference/AddGroupUser200Response.md b/docs/reference/AddGroupUser200Response.md new file mode 100644 index 0000000..54e2831 --- /dev/null +++ b/docs/reference/AddGroupUser200Response.md @@ -0,0 +1,29 @@ +# AddGroupUser200Response + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **str** | User ID that was added | [optional] + +## Example + +```python +from flat_api.models.add_group_user200_response import AddGroupUser200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of AddGroupUser200Response from a JSON string +add_group_user200_response_instance = AddGroupUser200Response.from_json(json) +# print the JSON string representation of the object +print(AddGroupUser200Response.to_json()) + +# convert the object into a dict +add_group_user200_response_dict = add_group_user200_response_instance.to_dict() +# create an instance of AddGroupUser200Response from a dict +add_group_user200_response_from_dict = AddGroupUser200Response.from_dict(add_group_user200_response_dict) +``` +[[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/AddGroupUserRequest.md b/docs/reference/AddGroupUserRequest.md new file mode 100644 index 0000000..1ea7926 --- /dev/null +++ b/docs/reference/AddGroupUserRequest.md @@ -0,0 +1,29 @@ +# AddGroupUserRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **str** | ID of the student to add | + +## Example + +```python +from flat_api.models.add_group_user_request import AddGroupUserRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AddGroupUserRequest from a JSON string +add_group_user_request_instance = AddGroupUserRequest.from_json(json) +# print the JSON string representation of the object +print(AddGroupUserRequest.to_json()) + +# convert the object into a dict +add_group_user_request_dict = add_group_user_request_instance.to_dict() +# create an instance of AddGroupUserRequest from a dict +add_group_user_request_from_dict = AddGroupUserRequest.from_dict(add_group_user_request_dict) +``` +[[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/ApiAccessToken.md b/docs/reference/ApiAccessToken.md new file mode 100644 index 0000000..8f4161e --- /dev/null +++ b/docs/reference/ApiAccessToken.md @@ -0,0 +1,35 @@ +# ApiAccessToken + +An API access token + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of this private token | [optional] +**name** | **str** | Name of the personal access token | [optional] +**token** | **str** | The token. This token will only be returned once, then only the first 4 characters will be returned. | [optional] +**issued_date** | **datetime** | The date when this token was issued | [optional] +**expiration_date** | **datetime** | The date when this token will expire | [optional] +**scopes** | [**List[AppScopes]**](AppScopes.md) | The list of scopes associated to the token | [optional] + +## Example + +```python +from flat_api.models.api_access_token import ApiAccessToken + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiAccessToken from a JSON string +api_access_token_instance = ApiAccessToken.from_json(json) +# print the JSON string representation of the object +print(ApiAccessToken.to_json()) + +# convert the object into a dict +api_access_token_dict = api_access_token_instance.to_dict() +# create an instance of ApiAccessToken from a dict +api_access_token_from_dict = ApiAccessToken.from_dict(api_access_token_dict) +``` +[[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/AppScopes.md b/docs/reference/AppScopes.md new file mode 100644 index 0000000..fb17b22 --- /dev/null +++ b/docs/reference/AppScopes.md @@ -0,0 +1,55 @@ +# AppScopes + +Available scopes + +## Enum + +* `ACCOUNT_DOT_PUBLIC_PROFILE` (value: `'account.public_profile'`) + +* `ACCOUNT_DOT_EMAIL` (value: `'account.email'`) + +* `ACCOUNT_DOT_EDUCATION_PROFILE` (value: `'account.education_profile'`) + +* `SCORES_DOT_READONLY` (value: `'scores.readonly'`) + +* `SCORES_DOT_SOCIAL` (value: `'scores.social'`) + +* `SCORES` (value: `'scores'`) + +* `COLLECTIONS_DOT_READONLY` (value: `'collections.readonly'`) + +* `COLLECTIONS_DOT_ADD_SCORES` (value: `'collections.add_scores'`) + +* `COLLECTIONS` (value: `'collections'`) + +* `NOTIFICATIONS_DOT_READONLY` (value: `'notifications.readonly'`) + +* `EDU_DOT_RESOURCES` (value: `'edu.resources'`) + +* `EDU_DOT_RESOURCES_DOT_READONLY` (value: `'edu.resources.readonly'`) + +* `EDU_DOT_CLASSES` (value: `'edu.classes'`) + +* `EDU_DOT_CLASSES_DOT_READONLY` (value: `'edu.classes.readonly'`) + +* `EDU_DOT_ASSIGNMENTS` (value: `'edu.assignments'`) + +* `EDU_DOT_ASSIGNMENTS_DOT_READONLY` (value: `'edu.assignments.readonly'`) + +* `EDU_DOT_ADMIN` (value: `'edu.admin'`) + +* `EDU_DOT_ADMIN_DOT_LTI` (value: `'edu.admin.lti'`) + +* `EDU_DOT_ADMIN_DOT_LTI_DOT_READONLY` (value: `'edu.admin.lti.readonly'`) + +* `EDU_DOT_ADMIN_DOT_USERS` (value: `'edu.admin.users'`) + +* `EDU_DOT_ADMIN_DOT_USERS_DOT_READONLY` (value: `'edu.admin.users.readonly'`) + +* `TASKS_DOT_READONLY` (value: `'tasks.readonly'`) + +* `OMR` (value: `'omr'`) + +[[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/Assignment.md b/docs/reference/Assignment.md new file mode 100644 index 0000000..387db53 --- /dev/null +++ b/docs/reference/Assignment.md @@ -0,0 +1,54 @@ +# Assignment + +Assignment details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the assignment | +**type** | [**AssignmentType**](AssignmentType.md) | | +**capabilities** | [**AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **str** | Title of the assignment | +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | 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** | **str** | 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** | **str** | The URL of the cover to display | [optional] +**cover_file** | **str** | The id of the cover to display | [optional] +**attachments** | [**List[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 assignment | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**toolset** | **str** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playbacks 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** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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] + +## Example + +```python +from flat_api.models.assignment import Assignment + +# TODO update the JSON string below +json = "{}" +# create an instance of Assignment from a JSON string +assignment_instance = Assignment.from_json(json) +# print the JSON string representation of the object +print(Assignment.to_json()) + +# convert the object into a dict +assignment_dict = assignment_instance.to_dict() +# create an instance of Assignment from a dict +assignment_from_dict = Assignment.from_dict(assignment_dict) +``` +[[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/AssignmentCapabilities.md b/docs/reference/AssignmentCapabilities.md new file mode 100644 index 0000000..8e5df85 --- /dev/null +++ b/docs/reference/AssignmentCapabilities.md @@ -0,0 +1,34 @@ +# AssignmentCapabilities + +Capabilities the current user has on this assignment. Each capability corresponds to a fine-grained action that a user may take. + +## 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** | [**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 | + +## Example + +```python +from flat_api.models.assignment_capabilities import AssignmentCapabilities + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCapabilities from a JSON string +assignment_capabilities_instance = AssignmentCapabilities.from_json(json) +# print the JSON string representation of the object +print(AssignmentCapabilities.to_json()) + +# convert the object into a dict +assignment_capabilities_dict = assignment_capabilities_instance.to_dict() +# create an instance of AssignmentCapabilities from a dict +assignment_capabilities_from_dict = AssignmentCapabilities.from_dict(assignment_capabilities_dict) +``` +[[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/AssignmentCapabilitiesCanPublishInClassError.md b/docs/reference/AssignmentCapabilitiesCanPublishInClassError.md new file mode 100644 index 0000000..3041412 --- /dev/null +++ b/docs/reference/AssignmentCapabilitiesCanPublishInClassError.md @@ -0,0 +1,31 @@ +# AssignmentCapabilitiesCanPublishInClassError + +If `canPublishInClass` and `canEdit` are false, the issue why this assignment cannot be published in a class + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | A corresponding code for this error | +**message** | **str** | A printable and localized message for this error | + +## Example + +```python +from flat_api.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCapabilitiesCanPublishInClassError from a JSON string +assignment_capabilities_can_publish_in_class_error_instance = AssignmentCapabilitiesCanPublishInClassError.from_json(json) +# print the JSON string representation of the object +print(AssignmentCapabilitiesCanPublishInClassError.to_json()) + +# convert the object into a dict +assignment_capabilities_can_publish_in_class_error_dict = assignment_capabilities_can_publish_in_class_error_instance.to_dict() +# create an instance of AssignmentCapabilitiesCanPublishInClassError from a dict +assignment_capabilities_can_publish_in_class_error_from_dict = AssignmentCapabilitiesCanPublishInClassError.from_dict(assignment_capabilities_can_publish_in_class_error_dict) +``` +[[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/AssignmentCopy.md b/docs/reference/AssignmentCopy.md new file mode 100644 index 0000000..7fcbbd8 --- /dev/null +++ b/docs/reference/AssignmentCopy.md @@ -0,0 +1,33 @@ +# AssignmentCopy + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classroom** | **str** | The destination classroom where the assignment will be copied | +**assignment** | **str** | An optional destination assignment where the original assignment 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] +**library_parent** | **str** | Identifier of the parent resource where the new one will be 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] + +## Example + +```python +from flat_api.models.assignment_copy import AssignmentCopy + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCopy from a JSON string +assignment_copy_instance = AssignmentCopy.from_json(json) +# print the JSON string representation of the object +print(AssignmentCopy.to_json()) + +# convert the object into a dict +assignment_copy_dict = assignment_copy_instance.to_dict() +# create an instance of AssignmentCopy from a dict +assignment_copy_from_dict = AssignmentCopy.from_dict(assignment_copy_dict) +``` +[[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/AssignmentCopyResponse.md b/docs/reference/AssignmentCopyResponse.md new file mode 100644 index 0000000..ebba3fb --- /dev/null +++ b/docs/reference/AssignmentCopyResponse.md @@ -0,0 +1,54 @@ +# AssignmentCopyResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the assignment | +**type** | [**AssignmentType**](AssignmentType.md) | | +**capabilities** | [**AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **str** | Title of the assignment | +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | 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** | **str** | 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** | **str** | The URL of the cover to display | [optional] +**cover_file** | **str** | The id of the cover to display | [optional] +**attachments** | [**List[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 assignment | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**toolset** | **str** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playbacks 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** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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** | **str** | If this assignment is stored as a resource in the Flat for Education Resource Library, the unique identifier of the resource. | [optional] + +## Example + +```python +from flat_api.models.assignment_copy_response import AssignmentCopyResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCopyResponse from a JSON string +assignment_copy_response_instance = AssignmentCopyResponse.from_json(json) +# print the JSON string representation of the object +print(AssignmentCopyResponse.to_json()) + +# convert the object into a dict +assignment_copy_response_dict = assignment_copy_response_instance.to_dict() +# create an instance of AssignmentCopyResponse from a dict +assignment_copy_response_from_dict = AssignmentCopyResponse.from_dict(assignment_copy_response_dict) +``` +[[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/AssignmentCopyToClass.md b/docs/reference/AssignmentCopyToClass.md new file mode 100644 index 0000000..09e2506 --- /dev/null +++ b/docs/reference/AssignmentCopyToClass.md @@ -0,0 +1,32 @@ +# AssignmentCopyToClass + +Copy the assignment to a class + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classroom** | **str** | The destination classroom where the assignment will be copied | +**assignment** | **str** | An optional destination assignment where the original assignment 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] + +## Example + +```python +from flat_api.models.assignment_copy_to_class import AssignmentCopyToClass + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCopyToClass from a JSON string +assignment_copy_to_class_instance = AssignmentCopyToClass.from_json(json) +# print the JSON string representation of the object +print(AssignmentCopyToClass.to_json()) + +# convert the object into a dict +assignment_copy_to_class_dict = assignment_copy_to_class_instance.to_dict() +# create an instance of AssignmentCopyToClass from a dict +assignment_copy_to_class_from_dict = AssignmentCopyToClass.from_dict(assignment_copy_to_class_dict) +``` +[[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/AssignmentCopyToResourceLibrary.md b/docs/reference/AssignmentCopyToResourceLibrary.md new file mode 100644 index 0000000..5edadaf --- /dev/null +++ b/docs/reference/AssignmentCopyToResourceLibrary.md @@ -0,0 +1,31 @@ +# AssignmentCopyToResourceLibrary + +Copy the assignment to the EDU Resource Library + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**library_parent** | **str** | Identifier of the parent resource where the new one will be 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] + +## Example + +```python +from flat_api.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentCopyToResourceLibrary from a JSON string +assignment_copy_to_resource_library_instance = AssignmentCopyToResourceLibrary.from_json(json) +# print the JSON string representation of the object +print(AssignmentCopyToResourceLibrary.to_json()) + +# convert the object into a dict +assignment_copy_to_resource_library_dict = assignment_copy_to_resource_library_instance.to_dict() +# create an instance of AssignmentCopyToResourceLibrary from a dict +assignment_copy_to_resource_library_from_dict = AssignmentCopyToResourceLibrary.from_dict(assignment_copy_to_resource_library_dict) +``` +[[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/AssignmentGroup.md b/docs/reference/AssignmentGroup.md new file mode 100644 index 0000000..35baddf --- /dev/null +++ b/docs/reference/AssignmentGroup.md @@ -0,0 +1,33 @@ +# AssignmentGroup + +A group assigned to an assignment for shared writing assignments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the group | +**name** | **str** | The display name of the group | +**parent** | **str** | 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** | **List[str]** | Array of user IDs that are members of this group | + +## Example + +```python +from flat_api.models.assignment_group import AssignmentGroup + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentGroup from a JSON string +assignment_group_instance = AssignmentGroup.from_json(json) +# print the JSON string representation of the object +print(AssignmentGroup.to_json()) + +# convert the object into a dict +assignment_group_dict = assignment_group_instance.to_dict() +# create an instance of AssignmentGroup from a dict +assignment_group_from_dict = AssignmentGroup.from_dict(assignment_group_dict) +``` +[[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/AssignmentSubmission.md b/docs/reference/AssignmentSubmission.md new file mode 100644 index 0000000..521f3af --- /dev/null +++ b/docs/reference/AssignmentSubmission.md @@ -0,0 +1,48 @@ +# AssignmentSubmission + +Assignment Submission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the submission | +**state** | [**AssignmentSubmissionState**](AssignmentSubmissionState.md) | | +**classroom** | **str** | Unique identifier of the classroom where the assignment was posted | +**assignment** | **str** | Unique identifier of the assignment | +**creator** | **str** | The User identifier of the student who created the submission | +**creation_date** | **str** | The date when the submission was created | +**attachments** | [**List[MediaAttachment]**](MediaAttachment.md) | | +**submission_date** | **str** | The date when the student submitted their work | [optional] +**return_date** | **str** | The date when the teacher returned the work | [optional] +**return_creator** | **str** | 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 to the teacher, and is copied 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** | **List[str]** | The ids of exercises when they need to be in a specific order | [optional] +**playback** | [**List[AssignmentSubmissionPlayback]**](AssignmentSubmissionPlayback.md) | | +**comments** | [**AssignmentSubmissionComments**](AssignmentSubmissionComments.md) | | +**google_classroom** | [**GoogleClassroomSubmission**](GoogleClassroomSubmission.md) | | [optional] +**microsoft_graph** | [**MicrosoftGraphSubmission**](MicrosoftGraphSubmission.md) | | [optional] +**lti** | [**AssignmentSubmissionLti**](AssignmentSubmissionLti.md) | | [optional] + +## Example + +```python +from flat_api.models.assignment_submission import AssignmentSubmission + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmission from a JSON string +assignment_submission_instance = AssignmentSubmission.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmission.to_json()) + +# convert the object into a dict +assignment_submission_dict = assignment_submission_instance.to_dict() +# create an instance of AssignmentSubmission from a dict +assignment_submission_from_dict = AssignmentSubmission.from_dict(assignment_submission_dict) +``` +[[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/AssignmentSubmissionComment.md b/docs/reference/AssignmentSubmissionComment.md new file mode 100644 index 0000000..5944b32 --- /dev/null +++ b/docs/reference/AssignmentSubmissionComment.md @@ -0,0 +1,36 @@ +# AssignmentSubmissionComment + +Feedback comment added to an assignment submission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The comment unique identifier | [optional] +**user** | **str** | The author unique identifier | [optional] +**submission** | **str** | The submission unique identifier | [optional] +**var_date** | **datetime** | The date when the comment was posted | [optional] +**modification_date** | **datetime** | The date of the last comment modification | [optional] +**comment** | **str** | The comment text | [optional] +**unread** | **bool** | True if the comment is unread by the current user | [optional] + +## Example + +```python +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionComment from a JSON string +assignment_submission_comment_instance = AssignmentSubmissionComment.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionComment.to_json()) + +# convert the object into a dict +assignment_submission_comment_dict = assignment_submission_comment_instance.to_dict() +# create an instance of AssignmentSubmissionComment from a dict +assignment_submission_comment_from_dict = AssignmentSubmissionComment.from_dict(assignment_submission_comment_dict) +``` +[[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/AssignmentSubmissionCommentCreation.md b/docs/reference/AssignmentSubmissionCommentCreation.md new file mode 100644 index 0000000..86888a0 --- /dev/null +++ b/docs/reference/AssignmentSubmissionCommentCreation.md @@ -0,0 +1,30 @@ +# AssignmentSubmissionCommentCreation + +Creation of an assignment submission comment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**comment** | **str** | The comment text | + +## Example + +```python +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionCommentCreation from a JSON string +assignment_submission_comment_creation_instance = AssignmentSubmissionCommentCreation.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionCommentCreation.to_json()) + +# convert the object into a dict +assignment_submission_comment_creation_dict = assignment_submission_comment_creation_instance.to_dict() +# create an instance of AssignmentSubmissionCommentCreation from a dict +assignment_submission_comment_creation_from_dict = AssignmentSubmissionCommentCreation.from_dict(assignment_submission_comment_creation_dict) +``` +[[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/AssignmentSubmissionComments.md b/docs/reference/AssignmentSubmissionComments.md new file mode 100644 index 0000000..3f37ff6 --- /dev/null +++ b/docs/reference/AssignmentSubmissionComments.md @@ -0,0 +1,30 @@ +# 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] + +## Example + +```python +from flat_api.models.assignment_submission_comments import AssignmentSubmissionComments + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionComments from a JSON string +assignment_submission_comments_instance = AssignmentSubmissionComments.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionComments.to_json()) + +# convert the object into a dict +assignment_submission_comments_dict = assignment_submission_comments_instance.to_dict() +# create an instance of AssignmentSubmissionComments from a dict +assignment_submission_comments_from_dict = AssignmentSubmissionComments.from_dict(assignment_submission_comments_dict) +``` +[[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/AssignmentSubmissionHistory.md b/docs/reference/AssignmentSubmissionHistory.md new file mode 100644 index 0000000..4fe0149 --- /dev/null +++ b/docs/reference/AssignmentSubmissionHistory.md @@ -0,0 +1,42 @@ +# AssignmentSubmissionHistory + +History item of the submission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_date** | **datetime** | The date when the submission was changed | +**classroom** | **str** | The classroom unique identifier where the submission was changed | [optional] +**assignment** | **str** | The assignment unique identifier where the submission was changed | [optional] +**submission** | **str** | The submission unique identifier | [optional] +**users** | **List[str]** | The user(s) unique identifier(s) who made the change | +**source** | **str** | The source of the change if the change was made by a third-party software | [optional] +**state** | [**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** | **str** | The comment that is made to this submission | [optional] +**due_date** | **datetime** | The due date of this assignment | [optional] +**attachment** | [**AssignmentSubmissionHistoryAttachment**](AssignmentSubmissionHistoryAttachment.md) | | [optional] + +## Example + +```python +from flat_api.models.assignment_submission_history import AssignmentSubmissionHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionHistory from a JSON string +assignment_submission_history_instance = AssignmentSubmissionHistory.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionHistory.to_json()) + +# convert the object into a dict +assignment_submission_history_dict = assignment_submission_history_instance.to_dict() +# create an instance of AssignmentSubmissionHistory from a dict +assignment_submission_history_from_dict = AssignmentSubmissionHistory.from_dict(assignment_submission_history_dict) +``` +[[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/AssignmentSubmissionHistoryAttachment.md b/docs/reference/AssignmentSubmissionHistoryAttachment.md new file mode 100644 index 0000000..cda916f --- /dev/null +++ b/docs/reference/AssignmentSubmissionHistoryAttachment.md @@ -0,0 +1,31 @@ +# AssignmentSubmissionHistoryAttachment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **str** | The score identifier that changed | [optional] +**revision** | **str** | The revision identifier that changed | [optional] +**title** | **str** | The title of the score that changed | [optional] + +## Example + +```python +from flat_api.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionHistoryAttachment from a JSON string +assignment_submission_history_attachment_instance = AssignmentSubmissionHistoryAttachment.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionHistoryAttachment.to_json()) + +# convert the object into a dict +assignment_submission_history_attachment_dict = assignment_submission_history_attachment_instance.to_dict() +# create an instance of AssignmentSubmissionHistoryAttachment from a dict +assignment_submission_history_attachment_from_dict = AssignmentSubmissionHistoryAttachment.from_dict(assignment_submission_history_attachment_dict) +``` +[[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/AssignmentSubmissionHistoryState.md b/docs/reference/AssignmentSubmissionHistoryState.md new file mode 100644 index 0000000..c9f2a33 --- /dev/null +++ b/docs/reference/AssignmentSubmissionHistoryState.md @@ -0,0 +1,19 @@ +# AssignmentSubmissionHistoryState + +State of the submission history + +## Enum + +* `CREATED` (value: `'created'`) + +* `TURNEDIN` (value: `'turnedIn'`) + +* `RETURNED` (value: `'returned'`) + +* `GRADED` (value: `'graded'`) + +* `RESET` (value: `'reset'`) + +[[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/AssignmentSubmissionLti.md b/docs/reference/AssignmentSubmissionLti.md new file mode 100644 index 0000000..ccc5e59 --- /dev/null +++ b/docs/reference/AssignmentSubmissionLti.md @@ -0,0 +1,31 @@ +# AssignmentSubmissionLti + +If set, this submission has a linked LTI 1.3 AGS or LTI 1.1 Outcomes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**grade_service** | **str** | 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** | **str** | The sourcedid of the LTI submission when using LTI Outcomes | [optional] + +## Example + +```python +from flat_api.models.assignment_submission_lti import AssignmentSubmissionLti + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionLti from a JSON string +assignment_submission_lti_instance = AssignmentSubmissionLti.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionLti.to_json()) + +# convert the object into a dict +assignment_submission_lti_dict = assignment_submission_lti_instance.to_dict() +# create an instance of AssignmentSubmissionLti from a dict +assignment_submission_lti_from_dict = AssignmentSubmissionLti.from_dict(assignment_submission_lti_dict) +``` +[[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/AssignmentSubmissionPlayback.md b/docs/reference/AssignmentSubmissionPlayback.md new file mode 100644 index 0000000..b82e46b --- /dev/null +++ b/docs/reference/AssignmentSubmissionPlayback.md @@ -0,0 +1,31 @@ +# AssignmentSubmissionPlayback + +Playback used by a student for an assignment submission. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **str** | The score unique identifier | +**nb_play_attempt** | **float** | Number of times the score was played | + +## Example + +```python +from flat_api.models.assignment_submission_playback import AssignmentSubmissionPlayback + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionPlayback from a JSON string +assignment_submission_playback_instance = AssignmentSubmissionPlayback.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionPlayback.to_json()) + +# convert the object into a dict +assignment_submission_playback_dict = assignment_submission_playback_instance.to_dict() +# create an instance of AssignmentSubmissionPlayback from a dict +assignment_submission_playback_from_dict = AssignmentSubmissionPlayback.from_dict(assignment_submission_playback_dict) +``` +[[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/AssignmentSubmissionState.md b/docs/reference/AssignmentSubmissionState.md new file mode 100644 index 0000000..8477fcd --- /dev/null +++ b/docs/reference/AssignmentSubmissionState.md @@ -0,0 +1,17 @@ +# AssignmentSubmissionState + +State of the submission + +## Enum + +* `CREATED` (value: `'created'`) + +* `TURNEDIN` (value: `'turnedIn'`) + +* `RETURNED` (value: `'returned'`) + +* `GRADED` (value: `'graded'`) + +[[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/AssignmentSubmissionStudentsMode.md b/docs/reference/AssignmentSubmissionStudentsMode.md new file mode 100644 index 0000000..1457272 --- /dev/null +++ b/docs/reference/AssignmentSubmissionStudentsMode.md @@ -0,0 +1,13 @@ +# AssignmentSubmissionStudentsMode + +Submission mode for assignments: - \"single\": Individual submissions (default) - \"group\": Group submissions (for shared writing assignments) + +## Enum + +* `SINGLE` (value: `'single'`) + +* `GROUP` (value: `'group'`) + +[[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/AssignmentSubmissionUpdate.md b/docs/reference/AssignmentSubmissionUpdate.md new file mode 100644 index 0000000..e275d56 --- /dev/null +++ b/docs/reference/AssignmentSubmissionUpdate.md @@ -0,0 +1,36 @@ +# AssignmentSubmissionUpdate + +Assignment Submission creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attachments** | [**List[ClassAttachmentCreation]**](ClassAttachmentCreation.md) | | [optional] +**playback** | [**List[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 to the teacher, and is copied to `grade` once the teacher returns the submission | [optional] +**grade** | **float** | Optional grade. If unset, no grade was set. | [optional] +**exercises_ids** | **List[str]** | The ids of exercises when they need to be in a specific order | [optional] +**var_return** | **bool** | If `true`, the submission will be returned to the student (teachers only) | [optional] + +## Example + +```python +from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentSubmissionUpdate from a JSON string +assignment_submission_update_instance = AssignmentSubmissionUpdate.from_json(json) +# print the JSON string representation of the object +print(AssignmentSubmissionUpdate.to_json()) + +# convert the object into a dict +assignment_submission_update_dict = assignment_submission_update_instance.to_dict() +# create an instance of AssignmentSubmissionUpdate from a dict +assignment_submission_update_from_dict = AssignmentSubmissionUpdate.from_dict(assignment_submission_update_dict) +``` +[[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/AssignmentType.md b/docs/reference/AssignmentType.md new file mode 100644 index 0000000..38a4606 --- /dev/null +++ b/docs/reference/AssignmentType.md @@ -0,0 +1,23 @@ +# AssignmentType + +Type of the assignment + +## Enum + +* `NONE` (value: `'none'`) + +* `NEWSCORE` (value: `'newScore'`) + +* `SCORETEMPLATE` (value: `'scoreTemplate'`) + +* `SHAREDWRITING` (value: `'sharedWriting'`) + +* `WORKSHEET` (value: `'worksheet'`) + +* `WORKSHEETTEXT` (value: `'worksheetText'`) + +* `PERFORMANCE` (value: `'performance'`) + +[[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/AssignmentUpdate.md b/docs/reference/AssignmentUpdate.md new file mode 100644 index 0000000..e405e48 --- /dev/null +++ b/docs/reference/AssignmentUpdate.md @@ -0,0 +1,51 @@ +# AssignmentUpdate + +Assignment Resource Editing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**AssignmentType**](AssignmentType.md) | | [optional] +**title** | **str** | Title of the assignment | [optional] +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | Teacher-only instructions (plain text) | [optional] +**teacher_instructions_html** | **str** | 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** | [**List[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 playbacks 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** | **str** | 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** | **str** | The id of the cover to display | [optional] +**cover** | **str** | The URL of the cover to display | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignment with this value as the maximum of points | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**submission_students_mode** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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] + +## Example + +```python +from flat_api.models.assignment_update import AssignmentUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of AssignmentUpdate from a JSON string +assignment_update_instance = AssignmentUpdate.from_json(json) +# print the JSON string representation of the object +print(AssignmentUpdate.to_json()) + +# convert the object into a dict +assignment_update_dict = assignment_update_instance.to_dict() +# create an instance of AssignmentUpdate from a dict +assignment_update_from_dict = AssignmentUpdate.from_dict(assignment_update_dict) +``` +[[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/ClassApi.md b/docs/reference/ClassApi.md new file mode 100644 index 0000000..f73eaaa --- /dev/null +++ b/docs/reference/ClassApi.md @@ -0,0 +1,2686 @@ +# flat_api.ClassApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**activate_class**](ClassApi.md#activate_class) | **POST** /classes/{class}/activate | Activate the class +[**add_class_user**](ClassApi.md#add_class_user) | **PUT** /classes/{class}/users/{user} | Add a user to the class +[**archive_assignment**](ClassApi.md#archive_assignment) | **POST** /classes/{class}/assignments/{assignment}/archive | Archive the assignment +[**archive_class**](ClassApi.md#archive_class) | **POST** /classes/{class}/archive | Archive the class +[**copy_assignment**](ClassApi.md#copy_assignment) | **POST** /classes/{class}/assignments/{assignment}/copy | Copy an assignment +[**create_class**](ClassApi.md#create_class) | **POST** /classes | Create a new class +[**create_class_assignment**](ClassApi.md#create_class_assignment) | **POST** /classes/{class}/assignments | Assignment creation +[**create_submission**](ClassApi.md#create_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission +[**create_test_student_account**](ClassApi.md#create_test_student_account) | **POST** /classes/{class}/testStudent | Create a test student account +[**delete_assignment**](ClassApi.md#delete_assignment) | **DELETE** /classes/{class}/assignments/{assignment} | Delete an assignment +[**delete_class_user**](ClassApi.md#delete_class_user) | **DELETE** /classes/{class}/users/{user} | Remove a user from the class +[**delete_submission**](ClassApi.md#delete_submission) | **DELETE** /classes/{class}/assignments/{assignment}/submissions/{submission} | Reset a submission +[**delete_submission_comment**](ClassApi.md#delete_submission_comment) | **DELETE** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment} | Delete a feedback comment to a submission +[**edit_submission**](ClassApi.md#edit_submission) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission +[**enroll_class**](ClassApi.md#enroll_class) | **POST** /classes/enroll/{enrollmentCode} | Join a class +[**export_submissions_reviews_as_csv**](ClassApi.md#export_submissions_reviews_as_csv) | **GET** /classes/{class}/assignments/{assignment}/submissions/csv | CSV Grades exports +[**export_submissions_reviews_as_excel**](ClassApi.md#export_submissions_reviews_as_excel) | **GET** /classes/{class}/assignments/{assignment}/submissions/excel | Excel Grades exports +[**get_assignment**](ClassApi.md#get_assignment) | **GET** /classes/{class}/assignments/{assignment} | Get an assignment +[**get_class**](ClassApi.md#get_class) | **GET** /classes/{class} | Get the details of a single class +[**get_score_submissions**](ClassApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score +[**get_submission**](ClassApi.md#get_submission) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission +[**get_submission_comments**](ClassApi.md#get_submission_comments) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments | List the feedback comments of a submission +[**get_submission_history**](ClassApi.md#get_submission_history) | **GET** /classes/{class}/assignments/{assignment}/submissions/{submission}/history | Get the history of the submission +[**get_submissions**](ClassApi.md#get_submissions) | **GET** /classes/{class}/assignments/{assignment}/submissions | List the students' submissions +[**list_assignments**](ClassApi.md#list_assignments) | **GET** /classes/{class}/assignments | Assignments listing +[**list_class_student_submissions**](ClassApi.md#list_class_student_submissions) | **GET** /classes/{class}/students/{user}/submissions | List the submissions for a student +[**list_classes**](ClassApi.md#list_classes) | **GET** /classes | List the classes available for the current user +[**post_submission_comment**](ClassApi.md#post_submission_comment) | **POST** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments | Add a feedback comment to a submission +[**unarchive_assignment**](ClassApi.md#unarchive_assignment) | **DELETE** /classes/{class}/assignments/{assignment}/archive | Unarchive the assignment. +[**unarchive_class**](ClassApi.md#unarchive_class) | **DELETE** /classes/{class}/archive | Unarchive the class +[**update_class**](ClassApi.md#update_class) | **PUT** /classes/{class} | Update the class +[**update_class_assignment**](ClassApi.md#update_class_assignment) | **PUT** /classes/{class}/assignments/{assignment} | Update an assignment +[**update_submission_comment**](ClassApi.md#update_submission_comment) | **PUT** /classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment} | Update a feedback comment to a submission + + +# **activate_class** +> ClassDetails activate_class(var_class) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + + try: + # Activate the class + api_response = api_instance.activate_class(var_class) + print("The response of ClassApi->activate_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->activate_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The class details | - | +**0** | Error | - | + +[[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) + +# **add_class_user** +> add_class_user(var_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 their role in the Organization. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + user = 'user_example' # str | Unique identifier of the user + + try: + # Add a user to the class + api_instance.add_class_user(var_class, user) + except Exception as e: + print("Exception when calling ClassApi->add_class_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **user** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The user has been added to the class | - | +**0** | Error | - | + +[[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) + +# **archive_assignment** +> Assignment archive_assignment(var_class, assignment) + +Archive the assignment + +Archive the assignment + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # Archive the assignment + api_response = api_instance.archive_assignment(var_class, assignment) + print("The response of ClassApi->archive_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->archive_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The assignment details | - | +**0** | Error | - | + +[[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) + +# **archive_class** +> ClassDetails archive_class(var_class) + +Archive the class + +Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + + try: + # Archive the class + api_response = api_instance.archive_class(var_class) + print("The response of ClassApi->archive_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->archive_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The class details | - | +**0** | Error | - | + +[[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) + +# **copy_assignment** +> AssignmentCopyResponse copy_assignment(var_class, assignment, body) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_copy import AssignmentCopy +from flat_api.models.assignment_copy_response import AssignmentCopyResponse +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + body = flat_api.AssignmentCopy() # AssignmentCopy | + + try: + # Copy an assignment + api_response = api_instance.copy_assignment(var_class, assignment, body) + print("The response of ClassApi->copy_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->copy_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **body** | [**AssignmentCopy**](AssignmentCopy.md)| | + +### Return type + +[**AssignmentCopyResponse**](AssignmentCopyResponse.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new created assignment | - | +**0** | Error | - | + +[[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) + +# **create_class** +> ClassDetails create_class(body) + +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 classroom 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 be 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_creation import ClassCreation +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + body = flat_api.ClassCreation() # ClassCreation | + + try: + # Create a new class + api_response = api_instance.create_class(body) + print("The response of ClassApi->create_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->create_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ClassCreation**](ClassCreation.md)| | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new class details | - | +**402** | Account overquota | - | +**0** | Error | - | + +[[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) + +# **create_class_assignment** +> Assignment create_class_assignment(var_class, body) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + body = flat_api.ClassAssignmentUpdate() # ClassAssignmentUpdate | + + try: + # Assignment creation + api_response = api_instance.create_class_assignment(var_class, body) + print("The response of ClassApi->create_class_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->create_class_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **body** | [**ClassAssignmentUpdate**](ClassAssignmentUpdate.md)| | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The assignment has been created | - | +**0** | Error | - | + +[[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) + +# **create_submission** +> AssignmentSubmission create_submission(var_class, assignment, body) + +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`, `playback`, `exercisesIds` and `submit`. +Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + body = flat_api.AssignmentSubmissionUpdate() # AssignmentSubmissionUpdate | + + try: + # Create or edit a submission + api_response = api_instance.create_submission(var_class, assignment, body) + print("The response of ClassApi->create_submission:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->create_submission: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **body** | [**AssignmentSubmissionUpdate**](AssignmentSubmissionUpdate.md)| | + +### Return type + +[**AssignmentSubmission**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The submission | - | +**0** | Error | - | + +[[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) + +# **create_test_student_account** +> UserDetails create_test_student_account(var_class, reset=reset) + +Create a test student account + +Test student accounts can be created by teachers and admins to try out 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_details import UserDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + reset = True # bool | If true, the testing account will be re-created. (optional) + + try: + # Create a test student account + api_response = api_instance.create_test_student_account(var_class, reset=reset) + print("The response of ClassApi->create_test_student_account:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->create_test_student_account: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **reset** | **bool**| If true, the testing account will be re-created. | [optional] + +### Return type + +[**UserDetails**](UserDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Test account created | - | +**0** | Error | - | + +[[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) + +# **delete_assignment** +> delete_assignment(var_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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # Delete an assignment + api_instance.delete_assignment(var_class, assignment) + except Exception as e: + print("Exception when calling ClassApi->delete_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The assignment has been deleted | - | +**0** | Error | - | + +[[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) + +# **delete_class_user** +> delete_class_user(var_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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + user = 'user_example' # str | Unique identifier of the user + + try: + # Remove a user from the class + api_instance.delete_class_user(var_class, user) + except Exception as e: + print("Exception when calling ClassApi->delete_class_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **user** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The user has been removed from the class | - | +**0** | Error | - | + +[[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) + +# **delete_submission** +> AssignmentSubmission delete_submission(var_class, assignment, submission) + +Reset a submission + +Use this method as a teacher to reset a submission and allow the student to start the assignment over + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + + try: + # Reset a submission + api_response = api_instance.delete_submission(var_class, assignment, submission) + print("The response of ClassApi->delete_submission:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->delete_submission: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + +### Return type + +[**AssignmentSubmission**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The submission object once reset | - | +**0** | Error | - | + +[[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) + +# **delete_submission_comment** +> delete_submission_comment(var_class, assignment, submission, comment) + +Delete a feedback comment to a submission + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + comment = 'comment_example' # str | Unique identifier of the comment + + try: + # Delete a feedback comment to a submission + api_instance.delete_submission_comment(var_class, assignment, submission, comment) + except Exception as e: + print("Exception when calling ClassApi->delete_submission_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + **comment** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The comment has been deleted | - | +**0** | Error | - | + +[[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) + +# **edit_submission** +> AssignmentSubmission edit_submission(var_class, assignment, submission, body) + +Edit a submission + +Use this method as a teacher to update a submission and give feedback. +Teachers can only set `return`, `draftGrade` and `grade`. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + body = flat_api.AssignmentSubmissionUpdate() # AssignmentSubmissionUpdate | + + try: + # Edit a submission + api_response = api_instance.edit_submission(var_class, assignment, submission, body) + print("The response of ClassApi->edit_submission:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->edit_submission: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + **body** | [**AssignmentSubmissionUpdate**](AssignmentSubmissionUpdate.md)| | + +### Return type + +[**AssignmentSubmission**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The submission | - | +**0** | Error | - | + +[[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) + +# **enroll_class** +> ClassDetails enroll_class(enrollment_code) + +Join a class + +Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + enrollment_code = 'enrollment_code_example' # str | The enrollment code, available to the teacher in `ClassDetails` + + try: + # Join a class + api_response = api_instance.enroll_class(enrollment_code) + print("The response of ClassApi->enroll_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->enroll_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enrollment_code** | **str**| The enrollment code, available to the teacher in `ClassDetails` | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new class details | - | +**0** | Error | - | + +[[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) + +# **export_submissions_reviews_as_csv** +> bytes export_submissions_reviews_as_csv(var_class, assignment) + +CSV Grades exports + +Export list of submissions grades to a CSV file + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # CSV Grades exports + api_response = api_instance.export_submissions_reviews_as_csv(var_class, assignment) + print("The response of ClassApi->export_submissions_reviews_as_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->export_submissions_reviews_as_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +**bytes** + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/csv + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of submissions | - | +**0** | Error | - | + +[[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) + +# **export_submissions_reviews_as_excel** +> bytes export_submissions_reviews_as_excel(var_class, assignment) + +Excel Grades exports + +Export list of submissions grades to an Excel file + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # Excel Grades exports + api_response = api_instance.export_submissions_reviews_as_excel(var_class, assignment) + print("The response of ClassApi->export_submissions_reviews_as_excel:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->export_submissions_reviews_as_excel: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +**bytes** + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of submissions | - | +**0** | Error | - | + +[[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) + +# **get_assignment** +> Assignment get_assignment(var_class, 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # Get an assignment + api_response = api_instance.get_assignment(var_class, assignment) + print("The response of ClassApi->get_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The assignment has been retrieved | - | +**0** | Error | - | + +[[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) + +# **get_class** +> ClassDetails get_class(var_class) + +Get the details of a single class + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + + try: + # Get the details of a single class + api_response = api_instance.get_class(var_class) + print("The response of ClassApi->get_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new class details | - | +**0** | Error | - | + +[[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) + +# **get_score_submissions** +> List[AssignmentSubmission] get_score_submissions(score) + +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 who is part of the organization and has at least read access to the document. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: + # List submissions related to the score + api_response = api_instance.get_score_submissions(score) + print("The response of ClassApi->get_score_submissions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_score_submissions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 + +[**List[AssignmentSubmission]**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of submissions | - | +**0** | Error | - | + +[[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) + +# **get_submission** +> AssignmentSubmission get_submission(var_class, assignment, submission) + +Get a student submission + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + + try: + # Get a student submission + api_response = api_instance.get_submission(var_class, assignment, submission) + print("The response of ClassApi->get_submission:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_submission: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + +### Return type + +[**AssignmentSubmission**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A submission | - | +**0** | Error | - | + +[[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) + +# **get_submission_comments** +> List[AssignmentSubmissionComment] get_submission_comments(var_class, assignment, submission) + +List the feedback comments of a submission + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + + try: + # List the feedback comments of a submission + api_response = api_instance.get_submission_comments(var_class, assignment, submission) + print("The response of ClassApi->get_submission_comments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_submission_comments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + +### Return type + +[**List[AssignmentSubmissionComment]**](AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The comments of the submission | - | +**403** | Not granted to access to this submission | - | +**404** | Submission not found | - | +**0** | Error | - | + +[[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) + +# **get_submission_history** +> List[AssignmentSubmissionHistory] get_submission_history(var_class, assignment, submission) + +Get the history of the submission + +For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission_history import AssignmentSubmissionHistory +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + + try: + # Get the history of the submission + api_response = api_instance.get_submission_history(var_class, assignment, submission) + print("The response of ClassApi->get_submission_history:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_submission_history: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + +### Return type + +[**List[AssignmentSubmissionHistory]**](AssignmentSubmissionHistory.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The history of the submission | - | +**403** | Not granted to access to this submission | - | +**404** | Submission not found | - | +**0** | Error | - | + +[[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) + +# **get_submissions** +> List[AssignmentSubmission] get_submissions(var_class, assignment) + +List the students' submissions + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # List the students' submissions + api_response = api_instance.get_submissions(var_class, assignment) + print("The response of ClassApi->get_submissions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->get_submissions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +[**List[AssignmentSubmission]**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The submissions | - | +**0** | Error | - | + +[[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) + +# **list_assignments** +> List[ClassAssignment] list_assignments(var_class) + +Assignments listing + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_assignment import ClassAssignment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + + try: + # Assignments listing + api_response = api_instance.list_assignments(var_class) + print("The response of ClassApi->list_assignments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->list_assignments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + +### Return type + +[**List[ClassAssignment]**](ClassAssignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of assignments for the class | - | +**0** | Error | - | + +[[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) + +# **list_class_student_submissions** +> List[AssignmentSubmission] list_class_student_submissions(var_class, user) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + user = 'user_example' # str | Unique identifier of the user + + try: + # List the submissions for a student + api_response = api_instance.list_class_student_submissions(var_class, user) + print("The response of ClassApi->list_class_student_submissions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->list_class_student_submissions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **user** | **str**| Unique identifier of the user | + +### Return type + +[**List[AssignmentSubmission]**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The list of submissions | - | +**0** | Error | - | + +[[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) + +# **list_classes** +> List[ClassDetails] list_classes(state=state) + +List the classes available for the current user + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + state = 'active' # str | Filter the classes by state (optional) (default to 'active') + + try: + # List the classes available for the current user + api_response = api_instance.list_classes(state=state) + print("The response of ClassApi->list_classes:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->list_classes: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **state** | **str**| Filter the classes by state | [optional] [default to 'active'] + +### Return type + +[**List[ClassDetails]**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The list of classes | - | +**0** | Error | - | + +[[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) + +# **post_submission_comment** +> AssignmentSubmissionComment post_submission_comment(var_class, assignment, submission, assignment_submission_comment_creation) + +Add a feedback comment to a submission + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + assignment_submission_comment_creation = flat_api.AssignmentSubmissionCommentCreation() # AssignmentSubmissionCommentCreation | + + try: + # Add a feedback comment to a submission + api_response = api_instance.post_submission_comment(var_class, assignment, submission, assignment_submission_comment_creation) + print("The response of ClassApi->post_submission_comment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->post_submission_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + **assignment_submission_comment_creation** | [**AssignmentSubmissionCommentCreation**](AssignmentSubmissionCommentCreation.md)| | + +### Return type + +[**AssignmentSubmissionComment**](AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The comment | - | +**403** | Not granted to access to this submission | - | +**404** | Submission not found | - | +**0** | Error | - | + +[[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) + +# **unarchive_assignment** +> Assignment unarchive_assignment(var_class, assignment) + +Unarchive the assignment. + +Mark the assignment as `active`. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + + try: + # Unarchive the assignment. + api_response = api_instance.unarchive_assignment(var_class, assignment) + print("The response of ClassApi->unarchive_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->unarchive_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The assignment details | - | +**0** | Error | - | + +[[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) + +# **unarchive_class** +> ClassDetails unarchive_class(var_class) + +Unarchive the class + +Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + + try: + # Unarchive the class + api_response = api_instance.unarchive_class(var_class) + print("The response of ClassApi->unarchive_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->unarchive_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The class details | - | +**0** | Error | - | + +[[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) + +# **update_class** +> ClassDetails update_class(var_class, body) + +Update the class + +Update the meta information of the class + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_details import ClassDetails +from flat_api.models.class_update import ClassUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + body = flat_api.ClassUpdate() # ClassUpdate | Details of the Class + + try: + # Update the class + api_response = api_instance.update_class(var_class, body) + print("The response of ClassApi->update_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->update_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **body** | [**ClassUpdate**](ClassUpdate.md)| Details of the Class | + +### Return type + +[**ClassDetails**](ClassDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new class details | - | +**0** | Error | - | + +[[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) + +# **update_class_assignment** +> Assignment update_class_assignment(var_class, assignment, body) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + body = flat_api.ClassAssignmentUpdate() # ClassAssignmentUpdate | + + try: + # Update an assignment + api_response = api_instance.update_class_assignment(var_class, assignment, body) + print("The response of ClassApi->update_class_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->update_class_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **body** | [**ClassAssignmentUpdate**](ClassAssignmentUpdate.md)| | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The assignment has been updated | - | +**0** | Error | - | + +[[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) + +# **update_submission_comment** +> AssignmentSubmissionComment update_submission_comment(var_class, assignment, submission, comment, assignment_submission_comment_creation) + +Update a feedback comment to a submission + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ClassApi(api_client) + var_class = 'var_class_example' # str | Unique identifier of the class + assignment = 'assignment_example' # str | Unique identifier of the assignment + submission = 'submission_example' # str | Unique identifier of the submission + comment = 'comment_example' # str | Unique identifier of the comment + assignment_submission_comment_creation = flat_api.AssignmentSubmissionCommentCreation() # AssignmentSubmissionCommentCreation | + + try: + # Update a feedback comment to a submission + api_response = api_instance.update_submission_comment(var_class, assignment, submission, comment, assignment_submission_comment_creation) + print("The response of ClassApi->update_submission_comment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClassApi->update_submission_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **var_class** | **str**| Unique identifier of the class | + **assignment** | **str**| Unique identifier of the assignment | + **submission** | **str**| Unique identifier of the submission | + **comment** | **str**| Unique identifier of the comment | + **assignment_submission_comment_creation** | [**AssignmentSubmissionCommentCreation**](AssignmentSubmissionCommentCreation.md)| | + +### Return type + +[**AssignmentSubmissionComment**](AssignmentSubmissionComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The comment | - | +**403** | Not granted to access to this submission | - | +**404** | Submission not found | - | +**0** | Error | - | + +[[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/reference/ClassAssignment.md b/docs/reference/ClassAssignment.md new file mode 100644 index 0000000..72d7137 --- /dev/null +++ b/docs/reference/ClassAssignment.md @@ -0,0 +1,69 @@ +# ClassAssignment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the assignment | +**type** | [**AssignmentType**](AssignmentType.md) | | +**capabilities** | [**AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **str** | Title of the assignment | +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | 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** | **str** | 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** | **str** | The URL of the cover to display | [optional] +**cover_file** | **str** | The id of the cover to display | [optional] +**attachments** | [**List[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 assignment | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**toolset** | **str** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playbacks 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** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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** | **str** | The User unique identifier of the creator of this assignment | [optional] +**state** | **str** | State of the assignment | +**classroom** | **str** | 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 past due. | [optional] +**assignee_mode** | **str** | Possible modes of assigning assignments | [optional] +**assigned_students** | **List[str]** | Identifiers for the students that have access to the assignment | [optional] +**assigned_groups** | [**List[AssignmentGroup]**](AssignmentGroup.md) | Groups that have access to the assignment (for shared writing assignments) | [optional] +**submissions** | [**List[AssignmentSubmission]**](AssignmentSubmission.md) | | +**google_classroom** | [**GoogleClassroomCoursework**](GoogleClassroomCoursework.md) | | [optional] +**microsoft_graph** | [**MicrosoftGraphAssignment**](MicrosoftGraphAssignment.md) | | [optional] +**mfc** | [**ClassAssignmentAllOfMfc**](ClassAssignmentAllOfMfc.md) | | [optional] +**canvas** | [**ClassAssignmentAllOfCanvas**](ClassAssignmentAllOfCanvas.md) | | [optional] +**lti** | [**ClassAssignmentAllOfLti**](ClassAssignmentAllOfLti.md) | | [optional] +**issue** | **str** | Detected issue for this assignment | [optional] + +## Example + +```python +from flat_api.models.class_assignment import ClassAssignment + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignment from a JSON string +class_assignment_instance = ClassAssignment.from_json(json) +# print the JSON string representation of the object +print(ClassAssignment.to_json()) + +# convert the object into a dict +class_assignment_dict = class_assignment_instance.to_dict() +# create an instance of ClassAssignment from a dict +class_assignment_from_dict = ClassAssignment.from_dict(class_assignment_dict) +``` +[[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/ClassAssignmentAllOfCanvas.md b/docs/reference/ClassAssignmentAllOfCanvas.md new file mode 100644 index 0000000..239a0f0 --- /dev/null +++ b/docs/reference/ClassAssignmentAllOfCanvas.md @@ -0,0 +1,31 @@ +# ClassAssignmentAllOfCanvas + +A Canvas LMS assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the assignment on Canvas | [optional] +**alternate_link** | **str** | Link to Canvas assignment | [optional] + +## Example + +```python +from flat_api.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentAllOfCanvas from a JSON string +class_assignment_all_of_canvas_instance = ClassAssignmentAllOfCanvas.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentAllOfCanvas.to_json()) + +# convert the object into a dict +class_assignment_all_of_canvas_dict = class_assignment_all_of_canvas_instance.to_dict() +# create an instance of ClassAssignmentAllOfCanvas from a dict +class_assignment_all_of_canvas_from_dict = ClassAssignmentAllOfCanvas.from_dict(class_assignment_all_of_canvas_dict) +``` +[[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/ClassAssignmentAllOfLti.md b/docs/reference/ClassAssignmentAllOfLti.md new file mode 100644 index 0000000..faa6978 --- /dev/null +++ b/docs/reference/ClassAssignmentAllOfLti.md @@ -0,0 +1,30 @@ +# ClassAssignmentAllOfLti + +An LTI assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Resource ID in the LMS | [optional] + +## Example + +```python +from flat_api.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentAllOfLti from a JSON string +class_assignment_all_of_lti_instance = ClassAssignmentAllOfLti.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentAllOfLti.to_json()) + +# convert the object into a dict +class_assignment_all_of_lti_dict = class_assignment_all_of_lti_instance.to_dict() +# create an instance of ClassAssignmentAllOfLti from a dict +class_assignment_all_of_lti_from_dict = ClassAssignmentAllOfLti.from_dict(class_assignment_all_of_lti_dict) +``` +[[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/ClassAssignmentAllOfMfc.md b/docs/reference/ClassAssignmentAllOfMfc.md new file mode 100644 index 0000000..624b7f0 --- /dev/null +++ b/docs/reference/ClassAssignmentAllOfMfc.md @@ -0,0 +1,31 @@ +# ClassAssignmentAllOfMfc + +A MusicFirst Classroom assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the task on MusicFirst Classroom | [optional] +**alternate_link** | **str** | Link to MusicFirst Classroom task | [optional] + +## Example + +```python +from flat_api.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentAllOfMfc from a JSON string +class_assignment_all_of_mfc_instance = ClassAssignmentAllOfMfc.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentAllOfMfc.to_json()) + +# convert the object into a dict +class_assignment_all_of_mfc_dict = class_assignment_all_of_mfc_instance.to_dict() +# create an instance of ClassAssignmentAllOfMfc from a dict +class_assignment_all_of_mfc_from_dict = ClassAssignmentAllOfMfc.from_dict(class_assignment_all_of_mfc_dict) +``` +[[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/ClassAssignmentUpdate.md b/docs/reference/ClassAssignmentUpdate.md new file mode 100644 index 0000000..1166729 --- /dev/null +++ b/docs/reference/ClassAssignmentUpdate.md @@ -0,0 +1,58 @@ +# ClassAssignmentUpdate + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**AssignmentType**](AssignmentType.md) | | [optional] +**title** | **str** | Title of the assignment | [optional] +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | Teacher-only instructions (plain text) | [optional] +**teacher_instructions_html** | **str** | 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** | [**List[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 playbacks 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** | **str** | 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** | **str** | The id of the cover to display | [optional] +**cover** | **str** | The URL of the cover to display | [optional] +**max_points** | **float** | If set, the grading will be enabled for the assignment with this value as the maximum of points | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**submission_students_mode** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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** | **str** | State of the assignment | [optional] +**due_date** | **datetime** | The due date of this assignment, late submissions will be marked as past 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** | [**ClassAssignmentUpdateAllOfGoogleClassroom**](ClassAssignmentUpdateAllOfGoogleClassroom.md) | | [optional] +**microsoft_graph** | [**ClassAssignmentUpdateAllOfMicrosoftGraph**](ClassAssignmentUpdateAllOfMicrosoftGraph.md) | | [optional] +**assignee_mode** | **str** | Possible modes of assigning assignments | [optional] +**assigned_students** | **List[str]** | Identifiers for the students that have access to the assignment | [optional] +**class_group_ids** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.class_assignment_update import ClassAssignmentUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentUpdate from a JSON string +class_assignment_update_instance = ClassAssignmentUpdate.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentUpdate.to_json()) + +# convert the object into a dict +class_assignment_update_dict = class_assignment_update_instance.to_dict() +# create an instance of ClassAssignmentUpdate from a dict +class_assignment_update_from_dict = ClassAssignmentUpdate.from_dict(class_assignment_update_dict) +``` +[[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/ClassAssignmentUpdateAllOfGoogleClassroom.md b/docs/reference/ClassAssignmentUpdateAllOfGoogleClassroom.md new file mode 100644 index 0000000..a55a0be --- /dev/null +++ b/docs/reference/ClassAssignmentUpdateAllOfGoogleClassroom.md @@ -0,0 +1,30 @@ +# ClassAssignmentUpdateAllOfGoogleClassroom + +Google Classroom options for this assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**topic_id** | **str** | Identifier of the topic where the assignment is created | [optional] + +## Example + +```python +from flat_api.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a JSON string +class_assignment_update_all_of_google_classroom_instance = ClassAssignmentUpdateAllOfGoogleClassroom.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentUpdateAllOfGoogleClassroom.to_json()) + +# convert the object into a dict +class_assignment_update_all_of_google_classroom_dict = class_assignment_update_all_of_google_classroom_instance.to_dict() +# create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a dict +class_assignment_update_all_of_google_classroom_from_dict = ClassAssignmentUpdateAllOfGoogleClassroom.from_dict(class_assignment_update_all_of_google_classroom_dict) +``` +[[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/ClassAssignmentUpdateAllOfMicrosoftGraph.md b/docs/reference/ClassAssignmentUpdateAllOfMicrosoftGraph.md new file mode 100644 index 0000000..4832556 --- /dev/null +++ b/docs/reference/ClassAssignmentUpdateAllOfMicrosoftGraph.md @@ -0,0 +1,30 @@ +# ClassAssignmentUpdateAllOfMicrosoftGraph + +Microsoft Graph options for this assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**categories** | **List[str]** | List of categories this assignment belongs to | [optional] + +## Example + +```python +from flat_api.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a JSON string +class_assignment_update_all_of_microsoft_graph_instance = ClassAssignmentUpdateAllOfMicrosoftGraph.from_json(json) +# print the JSON string representation of the object +print(ClassAssignmentUpdateAllOfMicrosoftGraph.to_json()) + +# convert the object into a dict +class_assignment_update_all_of_microsoft_graph_dict = class_assignment_update_all_of_microsoft_graph_instance.to_dict() +# create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a dict +class_assignment_update_all_of_microsoft_graph_from_dict = ClassAssignmentUpdateAllOfMicrosoftGraph.from_dict(class_assignment_update_all_of_microsoft_graph_dict) +``` +[[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/ClassAttachmentCreation.md b/docs/reference/ClassAttachmentCreation.md new file mode 100644 index 0000000..d1aa4e1 --- /dev/null +++ b/docs/reference/ClassAttachmentCreation.md @@ -0,0 +1,39 @@ +# ClassAttachmentCreation + +Attachment creation for an assignment or stream post. This attachment must contain a `score` or a `url`; its details are resolved and returned as a `MediaAttachment` once the assignment or stream post is created. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | 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** | **str** | 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** | **str** | A unique worksheet identifier | [optional] +**revision** | **str** | A unique revision identifier of a score | [optional] +**part_uuid** | **str** | The UUID of the instrument part selected for this attachment (for performance submissions) | [optional] +**sharing_mode** | [**MediaScoreSharingMode**](MediaScoreSharingMode.md) | | [optional] [default to MediaScoreSharingMode.READ] +**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** | **str** | The URL of the attachment. | [optional] +**google_drive_file_id** | **str** | 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] + +## Example + +```python +from flat_api.models.class_attachment_creation import ClassAttachmentCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassAttachmentCreation from a JSON string +class_attachment_creation_instance = ClassAttachmentCreation.from_json(json) +# print the JSON string representation of the object +print(ClassAttachmentCreation.to_json()) + +# convert the object into a dict +class_attachment_creation_dict = class_attachment_creation_instance.to_dict() +# create an instance of ClassAttachmentCreation from a dict +class_attachment_creation_from_dict = ClassAttachmentCreation.from_dict(class_attachment_creation_dict) +``` +[[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/ClassCreation.md b/docs/reference/ClassCreation.md new file mode 100644 index 0000000..2e52279 --- /dev/null +++ b/docs/reference/ClassCreation.md @@ -0,0 +1,34 @@ +# ClassCreation + +Creation of a classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the new class | +**section** | **str** | The section of the new class | [optional] +**level** | [**ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **List[str]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +## Example + +```python +from flat_api.models.class_creation import ClassCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassCreation from a JSON string +class_creation_instance = ClassCreation.from_json(json) +# print the JSON string representation of the object +print(ClassCreation.to_json()) + +# convert the object into a dict +class_creation_dict = class_creation_instance.to_dict() +# create an instance of ClassCreation from a dict +class_creation_from_dict = ClassCreation.from_dict(class_creation_dict) +``` +[[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/ClassDetails.md b/docs/reference/ClassDetails.md new file mode 100644 index 0000000..b5fa261 --- /dev/null +++ b/docs/reference/ClassDetails.md @@ -0,0 +1,54 @@ +# ClassDetails + +A classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the class | +**state** | [**ClassState**](ClassState.md) | | +**name** | **str** | The name of the class | +**section** | **str** | The section of the class | [optional] +**description** | **str** | An optional description for this class | [optional] +**organization** | **str** | The unique identifier of the Organization owning this class | [optional] +**owner** | **str** | The unique identifier of the User owning this class | [optional] +**creation_date** | **datetime** | The date when the class was created | +**modification_date** | **datetime** | The date when the class was last modified | [optional] +**enrollment_code** | **str** | [Teachers only] The enrollment code that can be used by the students to join the class | [optional] +**theme** | **str** | The theme identifier used in the Flat user interface | [optional] +**assignments_count** | **float** | The number of assignments created in the class | [optional] +**students_group** | [**GroupDetails**](GroupDetails.md) | | [optional] +**teachers_group** | [**GroupDetails**](GroupDetails.md) | | [optional] +**issues** | [**ClassDetailsIssues**](ClassDetailsIssues.md) | | [optional] +**google_classroom** | [**ClassDetailsGoogleClassroom**](ClassDetailsGoogleClassroom.md) | | [optional] +**google_drive** | [**ClassDetailsGoogleDrive**](ClassDetailsGoogleDrive.md) | | [optional] +**microsoft_graph** | [**ClassDetailsMicrosoftGraph**](ClassDetailsMicrosoftGraph.md) | | [optional] +**lti** | [**ClassDetailsLti**](ClassDetailsLti.md) | | [optional] +**canvas** | [**ClassDetailsCanvas**](ClassDetailsCanvas.md) | | [optional] +**mfc** | [**ClassDetailsMfc**](ClassDetailsMfc.md) | | [optional] +**clever** | [**ClassDetailsClever**](ClassDetailsClever.md) | | [optional] +**level** | [**ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **List[str]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +## Example + +```python +from flat_api.models.class_details import ClassDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetails from a JSON string +class_details_instance = ClassDetails.from_json(json) +# print the JSON string representation of the object +print(ClassDetails.to_json()) + +# convert the object into a dict +class_details_dict = class_details_instance.to_dict() +# create an instance of ClassDetails from a dict +class_details_from_dict = ClassDetails.from_dict(class_details_dict) +``` +[[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/ClassDetailsCanvas.md b/docs/reference/ClassDetailsCanvas.md new file mode 100644 index 0000000..46fc033 --- /dev/null +++ b/docs/reference/ClassDetailsCanvas.md @@ -0,0 +1,31 @@ +# ClassDetailsCanvas + +Meta information provided by Canvas LMS + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the course on Canvas | [optional] +**domain** | **str** | Canvas instance domain (e.g. \"canvas.instructure.com\") | [optional] + +## Example + +```python +from flat_api.models.class_details_canvas import ClassDetailsCanvas + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsCanvas from a JSON string +class_details_canvas_instance = ClassDetailsCanvas.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsCanvas.to_json()) + +# convert the object into a dict +class_details_canvas_dict = class_details_canvas_instance.to_dict() +# create an instance of ClassDetailsCanvas from a dict +class_details_canvas_from_dict = ClassDetailsCanvas.from_dict(class_details_canvas_dict) +``` +[[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/ClassDetailsClever.md b/docs/reference/ClassDetailsClever.md similarity index 57% rename from docs/ClassDetailsClever.md rename to docs/reference/ClassDetailsClever.md index ff19f16..04b454a 100644 --- a/docs/ClassDetailsClever.md +++ b/docs/reference/ClassDetailsClever.md @@ -1,6 +1,9 @@ # ClassDetailsClever +Clever.com section-related information + ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | Clever section unique identifier | [optional] @@ -11,6 +14,23 @@ Name | Type | Description | Notes **term_start_date** | **datetime** | Beginning date of the term | [optional] **term_end_date** | **datetime** | End date of the term | [optional] +## Example + +```python +from flat_api.models.class_details_clever import ClassDetailsClever + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsClever from a JSON string +class_details_clever_instance = ClassDetailsClever.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsClever.to_json()) + +# convert the object into a dict +class_details_clever_dict = class_details_clever_instance.to_dict() +# create an instance of ClassDetailsClever from a dict +class_details_clever_from_dict = ClassDetailsClever.from_dict(class_details_clever_dict) +``` [[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/ClassDetailsGoogleClassroom.md b/docs/reference/ClassDetailsGoogleClassroom.md new file mode 100644 index 0000000..dfd6630 --- /dev/null +++ b/docs/reference/ClassDetailsGoogleClassroom.md @@ -0,0 +1,31 @@ +# ClassDetailsGoogleClassroom + +Google Classroom course-related information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The course identifier on Google Classroom | [optional] +**alternate_link** | **str** | Absolute link to this course in the Classroom web UI | [optional] + +## Example + +```python +from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsGoogleClassroom from a JSON string +class_details_google_classroom_instance = ClassDetailsGoogleClassroom.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsGoogleClassroom.to_json()) + +# convert the object into a dict +class_details_google_classroom_dict = class_details_google_classroom_instance.to_dict() +# create an instance of ClassDetailsGoogleClassroom from a dict +class_details_google_classroom_from_dict = ClassDetailsGoogleClassroom.from_dict(class_details_google_classroom_dict) +``` +[[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/ClassDetailsGoogleDrive.md b/docs/reference/ClassDetailsGoogleDrive.md new file mode 100644 index 0000000..092fa64 --- /dev/null +++ b/docs/reference/ClassDetailsGoogleDrive.md @@ -0,0 +1,31 @@ +# ClassDetailsGoogleDrive + +Google Drive course-related information provided by Google Classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**teacher_folder_id** | **str** | [Teachers only] The Drive directory identifier of the teachers' folder | [optional] +**teacher_folder_alternate_link** | **str** | [Teachers only] The Drive URL of the teachers' folder | [optional] + +## Example + +```python +from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsGoogleDrive from a JSON string +class_details_google_drive_instance = ClassDetailsGoogleDrive.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsGoogleDrive.to_json()) + +# convert the object into a dict +class_details_google_drive_dict = class_details_google_drive_instance.to_dict() +# create an instance of ClassDetailsGoogleDrive from a dict +class_details_google_drive_from_dict = ClassDetailsGoogleDrive.from_dict(class_details_google_drive_dict) +``` +[[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/ClassDetailsIssues.md b/docs/reference/ClassDetailsIssues.md new file mode 100644 index 0000000..f9303c7 --- /dev/null +++ b/docs/reference/ClassDetailsIssues.md @@ -0,0 +1,30 @@ +# ClassDetailsIssues + +Detected issues for this class + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sync** | [**List[ClassDetailsIssuesSyncInner]**](ClassDetailsIssuesSyncInner.md) | Synchronization issues for the class | [optional] + +## Example + +```python +from flat_api.models.class_details_issues import ClassDetailsIssues + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsIssues from a JSON string +class_details_issues_instance = ClassDetailsIssues.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsIssues.to_json()) + +# convert the object into a dict +class_details_issues_dict = class_details_issues_instance.to_dict() +# create an instance of ClassDetailsIssues from a dict +class_details_issues_from_dict = ClassDetailsIssues.from_dict(class_details_issues_dict) +``` +[[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/ClassDetailsIssuesSyncInner.md b/docs/reference/ClassDetailsIssuesSyncInner.md new file mode 100644 index 0000000..29c586a --- /dev/null +++ b/docs/reference/ClassDetailsIssuesSyncInner.md @@ -0,0 +1,32 @@ +# ClassDetailsIssuesSyncInner + +A sync issue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The account user identifier | [optional] +**email** | **str** | The email address of the user concerned by this sync issue | [optional] +**reason** | **str** | The reason why the account cannot be synced | [optional] + +## Example + +```python +from flat_api.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsIssuesSyncInner from a JSON string +class_details_issues_sync_inner_instance = ClassDetailsIssuesSyncInner.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsIssuesSyncInner.to_json()) + +# convert the object into a dict +class_details_issues_sync_inner_dict = class_details_issues_sync_inner_instance.to_dict() +# create an instance of ClassDetailsIssuesSyncInner from a dict +class_details_issues_sync_inner_from_dict = ClassDetailsIssuesSyncInner.from_dict(class_details_issues_sync_inner_dict) +``` +[[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/ClassDetailsLti.md b/docs/reference/ClassDetailsLti.md new file mode 100644 index 0000000..f18cd57 --- /dev/null +++ b/docs/reference/ClassDetailsLti.md @@ -0,0 +1,33 @@ +# ClassDetailsLti + +Info about LTI context (1.1 and 1.3) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context_id** | **str** | Unique context identifier provided | [optional] +**context_title** | **str** | Context title | [optional] +**context_label** | **str** | Context label | [optional] +**has_nrps_service** | **bool** | If true, the class has been synchronized with the LTI 1.3 NRPS 2.0 service | [optional] + +## Example + +```python +from flat_api.models.class_details_lti import ClassDetailsLti + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsLti from a JSON string +class_details_lti_instance = ClassDetailsLti.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsLti.to_json()) + +# convert the object into a dict +class_details_lti_dict = class_details_lti_instance.to_dict() +# create an instance of ClassDetailsLti from a dict +class_details_lti_from_dict = ClassDetailsLti.from_dict(class_details_lti_dict) +``` +[[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/ClassDetailsMfc.md b/docs/reference/ClassDetailsMfc.md new file mode 100644 index 0000000..f5883a6 --- /dev/null +++ b/docs/reference/ClassDetailsMfc.md @@ -0,0 +1,31 @@ +# ClassDetailsMfc + +Meta information provided by MusicFirst Classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the course on MusicFirst Classroom | [optional] +**alternate_link** | **str** | Link to MusicFirst Classroom class | [optional] + +## Example + +```python +from flat_api.models.class_details_mfc import ClassDetailsMfc + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsMfc from a JSON string +class_details_mfc_instance = ClassDetailsMfc.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsMfc.to_json()) + +# convert the object into a dict +class_details_mfc_dict = class_details_mfc_instance.to_dict() +# create an instance of ClassDetailsMfc from a dict +class_details_mfc_from_dict = ClassDetailsMfc.from_dict(class_details_mfc_dict) +``` +[[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/ClassDetailsMicrosoftGraph.md b/docs/reference/ClassDetailsMicrosoftGraph.md new file mode 100644 index 0000000..38ca8ae --- /dev/null +++ b/docs/reference/ClassDetailsMicrosoftGraph.md @@ -0,0 +1,29 @@ +# ClassDetailsMicrosoftGraph + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The course identifier on Microsoft Graph | [optional] + +## Example + +```python +from flat_api.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassDetailsMicrosoftGraph from a JSON string +class_details_microsoft_graph_instance = ClassDetailsMicrosoftGraph.from_json(json) +# print the JSON string representation of the object +print(ClassDetailsMicrosoftGraph.to_json()) + +# convert the object into a dict +class_details_microsoft_graph_dict = class_details_microsoft_graph_instance.to_dict() +# create an instance of ClassDetailsMicrosoftGraph from a dict +class_details_microsoft_graph_from_dict = ClassDetailsMicrosoftGraph.from_dict(class_details_microsoft_graph_dict) +``` +[[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/ClassGradeLevel.md b/docs/reference/ClassGradeLevel.md new file mode 100644 index 0000000..4ef8f02 --- /dev/null +++ b/docs/reference/ClassGradeLevel.md @@ -0,0 +1,19 @@ +# ClassGradeLevel + +Class grade level + +## Enum + +* `ELEMENTARY` (value: `'elementary'`) + +* `MIDDLE` (value: `'middle'`) + +* `HIGH` (value: `'high'`) + +* `UNIVERSITY` (value: `'university'`) + +* `OTHER` (value: `'other'`) + +[[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/ClassRoles.md b/docs/reference/ClassRoles.md similarity index 60% rename from docs/ClassRoles.md rename to docs/reference/ClassRoles.md index 4878034..3fc5a27 100644 --- a/docs/ClassRoles.md +++ b/docs/reference/ClassRoles.md @@ -1,8 +1,12 @@ # ClassRoles -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +User's Class Role (for Edu users only) + +## Enum + +* `TEACHER` (value: `'teacher'`) + +* `STUDENT` (value: `'student'`) [[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/ClassState.md b/docs/reference/ClassState.md similarity index 50% rename from docs/ClassState.md rename to docs/reference/ClassState.md index fb07ffc..50c7594 100644 --- a/docs/ClassState.md +++ b/docs/reference/ClassState.md @@ -1,8 +1,16 @@ # ClassState -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +The state of a classroom + +## Enum + +* `ACTIVE` (value: `'active'`) + +* `INACTIVE` (value: `'inactive'`) + +* `ARCHIVED` (value: `'archived'`) + +* `DELETED` (value: `'deleted'`) [[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/ClassUpdate.md b/docs/reference/ClassUpdate.md new file mode 100644 index 0000000..9c3d502 --- /dev/null +++ b/docs/reference/ClassUpdate.md @@ -0,0 +1,34 @@ +# ClassUpdate + +Update of a classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the class | [optional] +**section** | **str** | The section of the class | [optional] +**level** | [**ClassGradeLevel**](ClassGradeLevel.md) | | [optional] +**skills_focused** | **List[str]** | Specific skills that will be focused in classroom | [optional] +**size** | **float** | Number of students in the classroom | [optional] + +## Example + +```python +from flat_api.models.class_update import ClassUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassUpdate from a JSON string +class_update_instance = ClassUpdate.from_json(json) +# print the JSON string representation of the object +print(ClassUpdate.to_json()) + +# convert the object into a dict +class_update_dict = class_update_instance.to_dict() +# create an instance of ClassUpdate from a dict +class_update_from_dict = ClassUpdate.from_dict(class_update_dict) +``` +[[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/Collection.md b/docs/reference/Collection.md new file mode 100644 index 0000000..102a478 --- /dev/null +++ b/docs/reference/Collection.md @@ -0,0 +1,47 @@ +# Collection + +Collection of scores + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the collection | +**title** | **str** | The title of the collection | +**html_url** | **str** | The url where the collection can be viewed in a web browser | +**type** | [**CollectionType**](CollectionType.md) | | +**label_key** | **str** | 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** | [**CollectionPrivacy**](CollectionPrivacy.md) | | [default to CollectionPrivacy.PRIVATE] +**sharing_key** | **str** | The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) | [optional] +**app** | [**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** | [**UserPublicSummary**](UserPublicSummary.md) | | [optional] +**organization** | **str** | If the score has been created in an organization, the identifier of this organization. | [optional] +**rights** | [**ResourceRights**](ResourceRights.md) | | [optional] +**collaborators** | [**List[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** | [**CollectionContents**](CollectionContents.md) | | +**capabilities** | [**CollectionCapabilities**](CollectionCapabilities.md) | | +**collections** | **List[str]** | The list of parent collections this score is included in. Please note that you might not have access to all of them. | [optional] + +## Example + +```python +from flat_api.models.collection import Collection + +# TODO update the JSON string below +json = "{}" +# create an instance of Collection from a JSON string +collection_instance = Collection.from_json(json) +# print the JSON string representation of the object +print(Collection.to_json()) + +# convert the object into a dict +collection_dict = collection_instance.to_dict() +# create an instance of Collection from a dict +collection_from_dict = Collection.from_dict(collection_dict) +``` +[[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/CollectionApi.md b/docs/reference/CollectionApi.md new file mode 100644 index 0000000..bb1daed --- /dev/null +++ b/docs/reference/CollectionApi.md @@ -0,0 +1,757 @@ +# flat_api.CollectionApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_score_to_collection**](CollectionApi.md#add_score_to_collection) | **PUT** /collections/{collection}/scores/{score} | Add a score to the collection +[**create_collection**](CollectionApi.md#create_collection) | **POST** /collections | Create a new collection +[**delete_collection**](CollectionApi.md#delete_collection) | **DELETE** /collections/{collection} | Delete the collection +[**delete_score_from_collection**](CollectionApi.md#delete_score_from_collection) | **DELETE** /collections/{collection}/scores/{score} | Delete a score from the collection +[**edit_collection**](CollectionApi.md#edit_collection) | **PUT** /collections/{collection} | Update a collection's metadata +[**get_collection**](CollectionApi.md#get_collection) | **GET** /collections/{collection} | Get collection details +[**list_collection_scores**](CollectionApi.md#list_collection_scores) | **GET** /collections/{collection}/scores | List the scores contained in a collection +[**list_collections**](CollectionApi.md#list_collections) | **GET** /collections | List the collections +[**untrash_collection**](CollectionApi.md#untrash_collection) | **POST** /collections/{collection}/untrash | Untrash a collection + + +# **add_score_to_collection** +> ScoreDetails add_score_to_collection(collection, score, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) + + try: + # Add a score to the collection + api_response = api_instance.add_score_to_collection(collection, score, sharing_key=sharing_key) + print("The response of CollectionApi->add_score_to_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->add_score_to_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 + +[**ScoreDetails**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Score details | - | +**403** | Not granted to access to this collection or score | - | +**404** | Collection or score not found | - | +**0** | Error | - | + +[[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) + +# **create_collection** +> Collection create_collection(body) + +Create a new collection + +This method will create a new collection in your account. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.collection import Collection +from flat_api.models.collection_creation import CollectionCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + body = flat_api.CollectionCreation() # CollectionCreation | + + try: + # Create a new collection + api_response = api_instance.create_collection(body) + print("The response of CollectionApi->create_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->create_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**CollectionCreation**](CollectionCreation.md)| | + +### Return type + +[**Collection**](Collection.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Collection created | - | +**400** | Bad collection creation request | - | +**0** | Error | - | + +[[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) + +# **delete_collection** +> delete_collection(collection) + +Delete the collection + +This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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: + # Delete the collection + api_instance.delete_collection(collection) + except Exception as e: + print("Exception when calling CollectionApi->delete_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Collection deleted | - | +**403** | Not granted to access to this collection | - | +**404** | Collection not found | - | +**0** | Error | - | + +[[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) + +# **delete_score_from_collection** +> delete_score_from_collection(collection, score, event_properties=event_properties, sharing_key=sharing_key) + +Delete a score from the collection + +This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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\"}' # str | Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Delete a score from the collection + api_instance.delete_score_from_collection(collection, score, event_properties=event_properties, sharing_key=sharing_key) + except Exception as e: + print("Exception when calling CollectionApi->delete_score_from_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` | [optional] + **sharing_key** | **str**| This sharing key must be specified to 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Score removed from the collection | - | +**403** | Not granted to access to this collection | - | +**404** | Collection not found | - | +**0** | Error | - | + +[[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) + +# **edit_collection** +> Collection edit_collection(collection, body) + +Update a collection's metadata + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.collection import Collection +from flat_api.models.collection_modification import CollectionModification +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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_api.CollectionModification() # CollectionModification | + + try: + # Update a collection's metadata + api_response = api_instance.edit_collection(collection, body) + print("The response of CollectionApi->edit_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->edit_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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** | [**CollectionModification**](CollectionModification.md)| | + +### Return type + +[**Collection**](Collection.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Collection details | - | +**403** | Not granted to access to this collection | - | +**404** | Collection not found | - | +**0** | Error | - | + +[[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) + +# **get_collection** +> Collection get_collection(collection, sharing_key=sharing_key) + +Get collection details + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.collection import Collection +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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' # str | This sharing key must be specified to 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) + + try: + # Get collection details + api_response = api_instance.get_collection(collection, sharing_key=sharing_key) + print("The response of CollectionApi->get_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->get_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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** | **str**| This sharing key must be specified to 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 + +[**Collection**](Collection.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Collection details | - | +**403** | Not granted to access to this collection | - | +**404** | Collection not found | - | +**0** | Error | - | + +[[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) + +# **list_collection_scores** +> List[ScoreDetails] list_collection_scores(collection, sort=sort, direction=direction, limit=limit, next=next, previous=previous, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | 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' # str | Sort (optional) + direction = 'direction_example' # str | Sort direction (optional) + limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + next = 'next_example' # str | 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 = 'previous_example' # str | 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 = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # List the scores contained in a collection + api_response = api_instance.list_collection_scores(collection, sort=sort, direction=direction, limit=limit, next=next, previous=previous, sharing_key=sharing_key) + print("The response of CollectionApi->list_collection_scores:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->list_collection_scores: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| 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** | **str**| Sort | [optional] + **direction** | **str**| Sort direction | [optional] + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] + **next** | **str**| 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** | **str**| 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** | **str**| This sharing key must be specified to 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 + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of scores | - | +**0** | Error | - | + +[[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) + +# **list_collections** +> List[Collection] list_collections(parent=parent, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.collection import Collection +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + parent = 'user' # str | 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 = 'sort_example' # str | Sort (optional) + direction = 'direction_example' # str | Sort direction (optional) + limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List the collections + api_response = api_instance.list_collections(parent=parent, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + print("The response of CollectionApi->list_collections:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->list_collections: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| 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** | **str**| Sort | [optional] + **direction** | **str**| Sort direction | [optional] + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] + **next** | **str**| 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** | **str**| 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 + +[**List[Collection]**](Collection.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of collections | - | +**0** | Error | - | + +[[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) + +# **untrash_collection** +> FlatErrorResponse untrash_collection(collection) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.flat_error_response import FlatErrorResponse +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.CollectionApi(api_client) + collection = 'collection_example' # str | Unique identifier of the collection. + + try: + # Untrash a collection + api_response = api_instance.untrash_collection(collection) + print("The response of CollectionApi->untrash_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionApi->untrash_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection** | **str**| Unique identifier of the collection. | + +### Return type + +[**FlatErrorResponse**](FlatErrorResponse.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Bad request - Operation no longer supported | - | +**0** | Error | - | + +[[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/reference/CollectionApp.md b/docs/reference/CollectionApp.md new file mode 100644 index 0000000..dd598de --- /dev/null +++ b/docs/reference/CollectionApp.md @@ -0,0 +1,32 @@ +# CollectionApp + +For App collections, the details of the app that created the collection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The app unique identifier | [optional] +**name** | **str** | The name of the app | [optional] +**logo** | **str** | The app logo url | [optional] + +## Example + +```python +from flat_api.models.collection_app import CollectionApp + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionApp from a JSON string +collection_app_instance = CollectionApp.from_json(json) +# print the JSON string representation of the object +print(CollectionApp.to_json()) + +# convert the object into a dict +collection_app_dict = collection_app_instance.to_dict() +# create an instance of CollectionApp from a dict +collection_app_from_dict = CollectionApp.from_dict(collection_app_dict) +``` +[[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/CollectionCapabilities.md b/docs/reference/CollectionCapabilities.md similarity index 52% rename from docs/CollectionCapabilities.md rename to docs/reference/CollectionCapabilities.md index 17826ca..aa7ce79 100644 --- a/docs/CollectionCapabilities.md +++ b/docs/reference/CollectionCapabilities.md @@ -1,14 +1,34 @@ # CollectionCapabilities +Capabilities the current user has on this collection. Each capability corresponds to a fine-grained action that a user may take. + ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_edit** | **bool** | Whether the current user can modify the metadata for the collection | [optional] -**can_share** | **bool** | Whether the current user can modify the sharing settings for the collection | [optional] -**can_delete** | **bool** | Whether the current user can delete the collection | [optional] -**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. | [optional] -**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. | [optional] +**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. | + +## Example + +```python +from flat_api.models.collection_capabilities import CollectionCapabilities + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionCapabilities from a JSON string +collection_capabilities_instance = CollectionCapabilities.from_json(json) +# print the JSON string representation of the object +print(CollectionCapabilities.to_json()) +# convert the object into a dict +collection_capabilities_dict = collection_capabilities_instance.to_dict() +# create an instance of CollectionCapabilities from a dict +collection_capabilities_from_dict = CollectionCapabilities.from_dict(collection_capabilities_dict) +``` [[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/CollectionContents.md b/docs/reference/CollectionContents.md new file mode 100644 index 0000000..1baed88 --- /dev/null +++ b/docs/reference/CollectionContents.md @@ -0,0 +1,30 @@ +# CollectionContents + +The contents of the collection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scores_count** | **int** | The number of scores in the collection | + +## Example + +```python +from flat_api.models.collection_contents import CollectionContents + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionContents from a JSON string +collection_contents_instance = CollectionContents.from_json(json) +# print the JSON string representation of the object +print(CollectionContents.to_json()) + +# convert the object into a dict +collection_contents_dict = collection_contents_instance.to_dict() +# create an instance of CollectionContents from a dict +collection_contents_from_dict = CollectionContents.from_dict(collection_contents_dict) +``` +[[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/CollectionCreation.md b/docs/reference/CollectionCreation.md new file mode 100644 index 0000000..c29b185 --- /dev/null +++ b/docs/reference/CollectionCreation.md @@ -0,0 +1,30 @@ +# CollectionCreation + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The title of the collection | [optional] +**privacy** | [**CollectionPrivacy**](CollectionPrivacy.md) | | [optional] [default to CollectionPrivacy.PRIVATE] + +## Example + +```python +from flat_api.models.collection_creation import CollectionCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionCreation from a JSON string +collection_creation_instance = CollectionCreation.from_json(json) +# print the JSON string representation of the object +print(CollectionCreation.to_json()) + +# convert the object into a dict +collection_creation_dict = collection_creation_instance.to_dict() +# create an instance of CollectionCreation from a dict +collection_creation_from_dict = CollectionCreation.from_dict(collection_creation_dict) +``` +[[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/CollectionModification.md b/docs/reference/CollectionModification.md new file mode 100644 index 0000000..32c79bc --- /dev/null +++ b/docs/reference/CollectionModification.md @@ -0,0 +1,31 @@ +# CollectionModification + +Edit the collection metadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The title of the collection | [optional] +**privacy** | [**CollectionPrivacy**](CollectionPrivacy.md) | | [optional] [default to CollectionPrivacy.PRIVATE] + +## Example + +```python +from flat_api.models.collection_modification import CollectionModification + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionModification from a JSON string +collection_modification_instance = CollectionModification.from_json(json) +# print the JSON string representation of the object +print(CollectionModification.to_json()) + +# convert the object into a dict +collection_modification_dict = collection_modification_instance.to_dict() +# create an instance of CollectionModification from a dict +collection_modification_from_dict = CollectionModification.from_dict(collection_modification_dict) +``` +[[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/CollectionPrivacy.md b/docs/reference/CollectionPrivacy.md new file mode 100644 index 0000000..7cf273c --- /dev/null +++ b/docs/reference/CollectionPrivacy.md @@ -0,0 +1,11 @@ +# CollectionPrivacy + +The collection main privacy mode. - `private`: The collection is private and can only be accessed, modified, and administered by specified collaborators. + +## Enum + +* `PRIVATE` (value: `'private'`) + +[[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/CollectionType.md b/docs/reference/CollectionType.md new file mode 100644 index 0000000..4274c84 --- /dev/null +++ b/docs/reference/CollectionType.md @@ -0,0 +1,23 @@ +# CollectionType + +Type of the collection. The type will influence the capabilities available on the collections and how this collection is/can be populated. - `root`: **Deprecated.** Previously the root collection of the user. The `allScores` virtual collection should be used instead. - `regular`: A regular collection created by the user. This collection can be deleted and modified by the user. - `app`: An automatically created collection containing the scores created by an app (e.g. Music Snippet) - `trash`: An automatically created collection containing the trashed scores. Virtual collections: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores + +## Enum + +* `ROOT` (value: `'root'`) + +* `REGULAR` (value: `'regular'`) + +* `APP` (value: `'app'`) + +* `TRASH` (value: `'trash'`) + +* `ALLSCORES` (value: `'allScores'`) + +* `COLLABORATIONS` (value: `'collaborations'`) + +* `LIKES` (value: `'likes'`) + +[[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/CreditTransaction.md b/docs/reference/CreditTransaction.md new file mode 100644 index 0000000..727ad02 --- /dev/null +++ b/docs/reference/CreditTransaction.md @@ -0,0 +1,38 @@ +# CreditTransaction + +A single credit ledger entry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the credit transaction | +**type** | **str** | Credit category. `ai` covers every AI-powered feature. | +**feature** | **str** | 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** | **str** | 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** | **str** | 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** | **str** | 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 | + +## Example + +```python +from flat_api.models.credit_transaction import CreditTransaction + +# TODO update the JSON string below +json = "{}" +# create an instance of CreditTransaction from a JSON string +credit_transaction_instance = CreditTransaction.from_json(json) +# print the JSON string representation of the object +print(CreditTransaction.to_json()) + +# convert the object into a dict +credit_transaction_dict = credit_transaction_instance.to_dict() +# create an instance of CreditTransaction from a dict +credit_transaction_from_dict = CreditTransaction.from_dict(credit_transaction_dict) +``` +[[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/EduLibrary.md b/docs/reference/EduLibrary.md new file mode 100644 index 0000000..6a36073 --- /dev/null +++ b/docs/reference/EduLibrary.md @@ -0,0 +1,33 @@ +# EduLibrary + +A Flat for Education Library + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the library. This one can be used to list the underlying resources using `GET /v2/eduResources?parent={library-id}` | +**name** | **str** | Name of the library | +**type** | **str** | Type of the library | +**visibility** | **str** | Visibility of the library | + +## Example + +```python +from flat_api.models.edu_library import EduLibrary + +# TODO update the JSON string below +json = "{}" +# create an instance of EduLibrary from a JSON string +edu_library_instance = EduLibrary.from_json(json) +# print the JSON string representation of the object +print(EduLibrary.to_json()) + +# convert the object into a dict +edu_library_dict = edu_library_instance.to_dict() +# create an instance of EduLibrary from a dict +edu_library_from_dict = EduLibrary.from_dict(edu_library_dict) +``` +[[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/EduResource.md b/docs/reference/EduResource.md new file mode 100644 index 0000000..5b4ef2e --- /dev/null +++ b/docs/reference/EduResource.md @@ -0,0 +1,44 @@ +# EduResource + +A Flat for Education resource contained in a resources library + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Resource unique identifier | +**creator** | **str** | The User identifier of the resource creator | [optional] +**type** | [**EduResourceType**](EduResourceType.md) | | +**privacy** | [**EduResourcePrivacy**](EduResourcePrivacy.md) | | [optional] [default to EduResourcePrivacy.PRIVATE] +**tags** | **List[str]** | Specific attributes for the resource (e.g. sample resources with custom design) | [optional] +**parent** | **str** | Identifier of the parent resource, e.g. a folder or root | [optional] +**title** | **str** | Title of the resource | +**sharing_description** | **str** | Sharing description of this resource | [optional] +**sharing_description_html** | **str** | 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** | [**EduResourceResource**](EduResourceResource.md) | | [optional] +**capabilities** | [**EduResourceCapabilities**](EduResourceCapabilities.md) | | +**subjects** | [**List[TeachingTheme]**](TeachingTheme.md) | The subjects of this resource, or the subjects of the resources included in the folder | [optional] +**grades** | [**List[Grade]**](Grade.md) | The grades of this resource, or the grades of the resources included in the folder. | [optional] + +## Example + +```python +from flat_api.models.edu_resource import EduResource + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResource from a JSON string +edu_resource_instance = EduResource.from_json(json) +# print the JSON string representation of the object +print(EduResource.to_json()) + +# convert the object into a dict +edu_resource_dict = edu_resource_instance.to_dict() +# create an instance of EduResource from a dict +edu_resource_from_dict = EduResource.from_dict(edu_resource_dict) +``` +[[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/EduResourceAssignmentCreation.md b/docs/reference/EduResourceAssignmentCreation.md new file mode 100644 index 0000000..e98109d --- /dev/null +++ b/docs/reference/EduResourceAssignmentCreation.md @@ -0,0 +1,30 @@ +# EduResourceAssignmentCreation + +Assignment-specific creation options. Only applicable when creating a resource with `type: assignment`. If `type` is not provided, defaults to `none`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**AssignmentType**](AssignmentType.md) | | [optional] + +## Example + +```python +from flat_api.models.edu_resource_assignment_creation import EduResourceAssignmentCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceAssignmentCreation from a JSON string +edu_resource_assignment_creation_instance = EduResourceAssignmentCreation.from_json(json) +# print the JSON string representation of the object +print(EduResourceAssignmentCreation.to_json()) + +# convert the object into a dict +edu_resource_assignment_creation_dict = edu_resource_assignment_creation_instance.to_dict() +# create an instance of EduResourceAssignmentCreation from a dict +edu_resource_assignment_creation_from_dict = EduResourceAssignmentCreation.from_dict(edu_resource_assignment_creation_dict) +``` +[[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/EduResourceCapabilities.md b/docs/reference/EduResourceCapabilities.md new file mode 100644 index 0000000..ea14593 --- /dev/null +++ b/docs/reference/EduResourceCapabilities.md @@ -0,0 +1,33 @@ +# EduResourceCapabilities + +Capabilities available for this resource + +## 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] + +## Example + +```python +from flat_api.models.edu_resource_capabilities import EduResourceCapabilities + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceCapabilities from a JSON string +edu_resource_capabilities_instance = EduResourceCapabilities.from_json(json) +# print the JSON string representation of the object +print(EduResourceCapabilities.to_json()) + +# convert the object into a dict +edu_resource_capabilities_dict = edu_resource_capabilities_instance.to_dict() +# create an instance of EduResourceCapabilities from a dict +edu_resource_capabilities_from_dict = EduResourceCapabilities.from_dict(edu_resource_capabilities_dict) +``` +[[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/EduResourceCopy.md b/docs/reference/EduResourceCopy.md new file mode 100644 index 0000000..3b144fb --- /dev/null +++ b/docs/reference/EduResourceCopy.md @@ -0,0 +1,30 @@ +# EduResourceCopy + +Copy an education resource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination** | **str** | Unique identifier of the destination folder for the copy. This can also be `root` to copy the resource at the root of the user resource library. | + +## Example + +```python +from flat_api.models.edu_resource_copy import EduResourceCopy + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceCopy from a JSON string +edu_resource_copy_instance = EduResourceCopy.from_json(json) +# print the JSON string representation of the object +print(EduResourceCopy.to_json()) + +# convert the object into a dict +edu_resource_copy_dict = edu_resource_copy_instance.to_dict() +# create an instance of EduResourceCopy from a dict +edu_resource_copy_from_dict = EduResourceCopy.from_dict(edu_resource_copy_dict) +``` +[[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/EduResourceCreation.md b/docs/reference/EduResourceCreation.md new file mode 100644 index 0000000..939ceaf --- /dev/null +++ b/docs/reference/EduResourceCreation.md @@ -0,0 +1,35 @@ +# EduResourceCreation + +Creation of an education resource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**EduResourceType**](EduResourceType.md) | | +**title** | **str** | Title of the resource | +**parent** | **str** | Identifier of the parent resource where the new one will be created, e.g. a folder id or `root` | [optional] [default to 'root'] +**sharing_description** | **str** | Sharing description of the resource | [optional] +**sharing_description_html** | **str** | HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. | [optional] +**resource** | [**EduResourceAssignmentCreation**](EduResourceAssignmentCreation.md) | | [optional] + +## Example + +```python +from flat_api.models.edu_resource_creation import EduResourceCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceCreation from a JSON string +edu_resource_creation_instance = EduResourceCreation.from_json(json) +# print the JSON string representation of the object +print(EduResourceCreation.to_json()) + +# convert the object into a dict +edu_resource_creation_dict = edu_resource_creation_instance.to_dict() +# create an instance of EduResourceCreation from a dict +edu_resource_creation_from_dict = EduResourceCreation.from_dict(edu_resource_creation_dict) +``` +[[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/EduResourceFolder.md b/docs/reference/EduResourceFolder.md new file mode 100644 index 0000000..ff8ffb1 --- /dev/null +++ b/docs/reference/EduResourceFolder.md @@ -0,0 +1,32 @@ +# EduResourceFolder + +Education resources folder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | Title of the folder | [optional] +**assignments_types** | [**List[AssignmentType]**](AssignmentType.md) | The assignment types of the resources included in the folder | [optional] +**resources_count** | **float** | The number of resources inside the folder | [optional] + +## Example + +```python +from flat_api.models.edu_resource_folder import EduResourceFolder + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceFolder from a JSON string +edu_resource_folder_instance = EduResourceFolder.from_json(json) +# print the JSON string representation of the object +print(EduResourceFolder.to_json()) + +# convert the object into a dict +edu_resource_folder_dict = edu_resource_folder_instance.to_dict() +# create an instance of EduResourceFolder from a dict +edu_resource_folder_from_dict = EduResourceFolder.from_dict(edu_resource_folder_dict) +``` +[[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/EduResourceLtiLink.md b/docs/reference/EduResourceLtiLink.md new file mode 100644 index 0000000..aec5b91 --- /dev/null +++ b/docs/reference/EduResourceLtiLink.md @@ -0,0 +1,30 @@ +# EduResourceLtiLink + +LTI Link details for the class + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lti_url** | **str** | A URL that can be used to launch LTI with this resource in a classroom. | + +## Example + +```python +from flat_api.models.edu_resource_lti_link import EduResourceLtiLink + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceLtiLink from a JSON string +edu_resource_lti_link_instance = EduResourceLtiLink.from_json(json) +# print the JSON string representation of the object +print(EduResourceLtiLink.to_json()) + +# convert the object into a dict +edu_resource_lti_link_dict = edu_resource_lti_link_instance.to_dict() +# create an instance of EduResourceLtiLink from a dict +edu_resource_lti_link_from_dict = EduResourceLtiLink.from_dict(edu_resource_lti_link_dict) +``` +[[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/EduResourceMove.md b/docs/reference/EduResourceMove.md new file mode 100644 index 0000000..873d814 --- /dev/null +++ b/docs/reference/EduResourceMove.md @@ -0,0 +1,30 @@ +# EduResourceMove + +Move an education resource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination** | **str** | Unique identifier of the destination folder for this resource. This can also be `root` to move the resource at the root of the user resource library. | + +## Example + +```python +from flat_api.models.edu_resource_move import EduResourceMove + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceMove from a JSON string +edu_resource_move_instance = EduResourceMove.from_json(json) +# print the JSON string representation of the object +print(EduResourceMove.to_json()) + +# convert the object into a dict +edu_resource_move_dict = edu_resource_move_instance.to_dict() +# create an instance of EduResourceMove from a dict +edu_resource_move_from_dict = EduResourceMove.from_dict(edu_resource_move_dict) +``` +[[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/EduResourcePrivacy.md b/docs/reference/EduResourcePrivacy.md new file mode 100644 index 0000000..806c277 --- /dev/null +++ b/docs/reference/EduResourcePrivacy.md @@ -0,0 +1,15 @@ +# EduResourcePrivacy + +The Education resource privacy mode. + +## Enum + +* `PRIVATE` (value: `'private'`) + +* `ORGANIZATIONPUBLIC` (value: `'organizationPublic'`) + +* `PUBLIC` (value: `'public'`) + +[[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/EduResourceResource.md b/docs/reference/EduResourceResource.md new file mode 100644 index 0000000..1966f22 --- /dev/null +++ b/docs/reference/EduResourceResource.md @@ -0,0 +1,55 @@ +# EduResourceResource + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the assignment | +**type** | [**AssignmentType**](AssignmentType.md) | | +**capabilities** | [**AssignmentCapabilities**](AssignmentCapabilities.md) | | +**title** | **str** | Title of the folder | +**description** | **str** | Student instructions and content of the assignment (plain text) | [optional] +**description_html** | **str** | 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** | **str** | 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** | **str** | 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** | **str** | The URL of the cover to display | [optional] +**cover_file** | **str** | The id of the cover to display | [optional] +**attachments** | [**List[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 assignment | [optional] +**release_grades** | **str** | 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** | Shuffle the worksheet exercises for each student | [optional] +**toolset** | **str** | The id of the associated toolset | [optional] +**nb_playback_authorized** | **float** | The number of playbacks 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** | [**AssignmentSubmissionStudentsMode**](AssignmentSubmissionStudentsMode.md) | | [optional] +**recording_type** | **str** | 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] +**assignments_types** | [**List[AssignmentType]**](AssignmentType.md) | The assignment types of the resources included in the folder | [optional] +**resources_count** | **float** | The number of resources inside the folder | [optional] + +## Example + +```python +from flat_api.models.edu_resource_resource import EduResourceResource + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceResource from a JSON string +edu_resource_resource_instance = EduResourceResource.from_json(json) +# print the JSON string representation of the object +print(EduResourceResource.to_json()) + +# convert the object into a dict +edu_resource_resource_dict = edu_resource_resource_instance.to_dict() +# create an instance of EduResourceResource from a dict +edu_resource_resource_from_dict = EduResourceResource.from_dict(edu_resource_resource_dict) +``` +[[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/CollectionPrivacy.md b/docs/reference/EduResourceType.md similarity index 56% rename from docs/CollectionPrivacy.md rename to docs/reference/EduResourceType.md index 7447ba9..c77ea4b 100644 --- a/docs/CollectionPrivacy.md +++ b/docs/reference/EduResourceType.md @@ -1,8 +1,12 @@ -# CollectionPrivacy +# EduResourceType -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +Type of an education resource + +## Enum + +* `ASSIGNMENT` (value: `'assignment'`) + +* `FOLDER` (value: `'folder'`) [[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/EduResourceUpdate.md b/docs/reference/EduResourceUpdate.md new file mode 100644 index 0000000..95e9971 --- /dev/null +++ b/docs/reference/EduResourceUpdate.md @@ -0,0 +1,35 @@ +# EduResourceUpdate + +Update of an education resource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | Title of the resource | [optional] +**sharing_description** | **str** | Sharing description of the resource | [optional] +**sharing_description_html** | **str** | HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. | [optional] +**privacy** | [**EduResourcePrivacy**](EduResourcePrivacy.md) | | [optional] [default to EduResourcePrivacy.PRIVATE] +**subjects** | [**List[TeachingTheme]**](TeachingTheme.md) | The subjects of this resource, or the subjects of the resources included in the folder | [optional] +**grades** | [**List[Grade]**](Grade.md) | The grades of this resource, or the grades of the resources included in the folder. | [optional] + +## Example + +```python +from flat_api.models.edu_resource_update import EduResourceUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceUpdate from a JSON string +edu_resource_update_instance = EduResourceUpdate.from_json(json) +# print the JSON string representation of the object +print(EduResourceUpdate.to_json()) + +# convert the object into a dict +edu_resource_update_dict = edu_resource_update_instance.to_dict() +# create an instance of EduResourceUpdate from a dict +edu_resource_update_from_dict = EduResourceUpdate.from_dict(edu_resource_update_dict) +``` +[[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/EduResourceUseInClass.md b/docs/reference/EduResourceUseInClass.md new file mode 100644 index 0000000..03c05ea --- /dev/null +++ b/docs/reference/EduResourceUseInClass.md @@ -0,0 +1,31 @@ +# EduResourceUseInClass + +Use an education resource in class + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classroom** | **str** | The destination classroom where the resource will be copied. | +**assignment** | **str** | An optional destination assignment where the original assignment will be copied. Must be a draft. | [optional] + +## Example + +```python +from flat_api.models.edu_resource_use_in_class import EduResourceUseInClass + +# TODO update the JSON string below +json = "{}" +# create an instance of EduResourceUseInClass from a JSON string +edu_resource_use_in_class_instance = EduResourceUseInClass.from_json(json) +# print the JSON string representation of the object +print(EduResourceUseInClass.to_json()) + +# convert the object into a dict +edu_resource_use_in_class_dict = edu_resource_use_in_class_instance.to_dict() +# create an instance of EduResourceUseInClass from a dict +edu_resource_use_in_class_from_dict = EduResourceUseInClass.from_dict(edu_resource_use_in_class_dict) +``` +[[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/EduResourcesApi.md b/docs/reference/EduResourcesApi.md new file mode 100644 index 0000000..2f11ee0 --- /dev/null +++ b/docs/reference/EduResourcesApi.md @@ -0,0 +1,961 @@ +# flat_api.EduResourcesApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**copy_edu_resource**](EduResourcesApi.md#copy_edu_resource) | **POST** /eduResources/{resource}/copy | Copy an education resource to a Resource Library +[**copy_edu_resource_to_demo_class**](EduResourcesApi.md#copy_edu_resource_to_demo_class) | **POST** /eduResources/{resource}/copyToDemoClass | Copy an education assignment to a teacher demo class +[**create_edu_resource**](EduResourcesApi.md#create_edu_resource) | **POST** /eduResources | Create a new education resource +[**create_edu_resource_lti_link**](EduResourcesApi.md#create_edu_resource_lti_link) | **POST** /eduResources/{resource}/createLtiLink | Create an LTI link for an education resource +[**delete_edu_resource**](EduResourcesApi.md#delete_edu_resource) | **DELETE** /eduResources/{resource} | Delete an education resource +[**get_edu_resource**](EduResourcesApi.md#get_edu_resource) | **GET** /eduResources/{resource} | Get an education resource +[**list_edu_libraries**](EduResourcesApi.md#list_edu_libraries) | **GET** /eduResources/libraries | List the education libraries +[**list_edu_resources**](EduResourcesApi.md#list_edu_resources) | **GET** /eduResources | List education resources in a library or folder +[**move_edu_resource**](EduResourcesApi.md#move_edu_resource) | **POST** /eduResources/{resource}/move | Move an education resource +[**update_edu_resource**](EduResourcesApi.md#update_edu_resource) | **PUT** /eduResources/{resource} | Update an education resource metadata +[**update_edu_resource_assignment**](EduResourcesApi.md#update_edu_resource_assignment) | **PUT** /eduResources/{resource}/assignment | Update an education resource assignment +[**use_edu_resource_in_class**](EduResourcesApi.md#use_edu_resource_in_class) | **POST** /eduResources/{resource}/useInClass | Use an education resource in a class + + +# **copy_edu_resource** +> EduResource copy_edu_resource(resource, edu_resource_copy) + +Copy an education resource to a Resource Library + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_copy import EduResourceCopy +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + edu_resource_copy = flat_api.EduResourceCopy() # EduResourceCopy | + + try: + # Copy an education resource to a Resource Library + api_response = api_instance.copy_edu_resource(resource, edu_resource_copy) + print("The response of EduResourcesApi->copy_edu_resource:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->copy_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + **edu_resource_copy** | [**EduResourceCopy**](EduResourceCopy.md)| | + +### Return type + +[**EduResource**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **copy_edu_resource_to_demo_class** +> ClassAssignment copy_edu_resource_to_demo_class(resource) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_assignment import ClassAssignment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + + try: + # Copy an education assignment to a teacher demo class + api_response = api_instance.copy_edu_resource_to_demo_class(resource) + print("The response of EduResourcesApi->copy_edu_resource_to_demo_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->copy_edu_resource_to_demo_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + +### Return type + +[**ClassAssignment**](ClassAssignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Assignment copied to the demo class | - | +**0** | Error | - | + +[[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) + +# **create_edu_resource** +> EduResource create_edu_resource(edu_resource_creation) + +Create a new education resource + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_creation import EduResourceCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + edu_resource_creation = flat_api.EduResourceCreation() # EduResourceCreation | + + try: + # Create a new education resource + api_response = api_instance.create_edu_resource(edu_resource_creation) + print("The response of EduResourcesApi->create_edu_resource:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->create_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **edu_resource_creation** | [**EduResourceCreation**](EduResourceCreation.md)| | + +### Return type + +[**EduResource**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **create_edu_resource_lti_link** +> EduResourceLtiLink create_edu_resource_lti_link(resource) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource_lti_link import EduResourceLtiLink +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + + try: + # Create an LTI link for an education resource + api_response = api_instance.create_edu_resource_lti_link(resource) + print("The response of EduResourcesApi->create_edu_resource_lti_link:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->create_edu_resource_lti_link: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + +### Return type + +[**EduResourceLtiLink**](EduResourceLtiLink.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Created LTI Link | - | +**0** | Error | - | + +[[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) + +# **delete_edu_resource** +> delete_edu_resource(resource) + +Delete an education resource + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + + try: + # Delete an education resource + api_instance.delete_edu_resource(resource) + except Exception as e: + print("Exception when calling EduResourcesApi->delete_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Resource deleted | - | +**0** | Error | - | + +[[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) + +# **get_edu_resource** +> EduResource get_edu_resource(resource) + +Get an education resource + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource import EduResource +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + + try: + # Get an education resource + api_response = api_instance.get_edu_resource(resource) + print("The response of EduResourcesApi->get_edu_resource:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->get_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + +### Return type + +[**EduResource**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **list_edu_libraries** +> List[EduLibrary] list_edu_libraries() + +List the education libraries + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_library import EduLibrary +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + + try: + # List the education libraries + api_response = api_instance.list_edu_libraries() + print("The response of EduResourcesApi->list_edu_libraries:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->list_edu_libraries: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**List[EduLibrary]**](EduLibrary.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **list_edu_resources** +> List[EduResource] list_edu_resources(parent=parent, without_subfolders_resources=without_subfolders_resources, type=type, subjects=subjects, assignment_types=assignment_types, grades=grades, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + +List education resources in a library or folder + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.edu_resource import EduResource +from flat_api.models.grade import Grade +from flat_api.models.teaching_theme import TeachingTheme +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + parent = 'root' # str | 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 = True # bool | For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. (optional) + type = 'type_example' # str | Filter the returned resources by type (optional) + subjects = [flat_api.TeachingTheme()] # List[TeachingTheme] | Filter the returned resources by subjects (optional) + assignment_types = [flat_api.AssignmentType()] # List[AssignmentType] | Filter the returned resources by assignment types (optional) + grades = [flat_api.Grade()] # List[Grade] | Filter the returned resources by grades (optional) + sort = 'creationDate' # str | Sort (optional) (default to 'creationDate') + direction = 'direction_example' # str | Sort direction (optional) + limit = 25 # int | This is the maximum number of resources that may be returned (optional) (default to 25) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List education resources in a library or folder + api_response = api_instance.list_edu_resources(parent=parent, without_subfolders_resources=without_subfolders_resources, type=type, subjects=subjects, assignment_types=assignment_types, grades=grades, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + print("The response of EduResourcesApi->list_edu_resources:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->list_edu_resources: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| 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. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. | [optional] + **type** | **str**| Filter the returned resources by type | [optional] + **subjects** | [**List[TeachingTheme]**](TeachingTheme.md)| Filter the returned resources by subjects | [optional] + **assignment_types** | [**List[AssignmentType]**](AssignmentType.md)| Filter the returned resources by assignment types | [optional] + **grades** | [**List[Grade]**](Grade.md)| Filter the returned resources by grades | [optional] + **sort** | **str**| Sort | [optional] [default to 'creationDate'] + **direction** | **str**| Sort direction | [optional] + **limit** | **int**| This is the maximum number of resources that may be returned | [optional] [default to 25] + **next** | **str**| 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** | **str**| 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 + +[**List[EduResource]**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of resources | * X-Total-Assignments-Count - Total number of assignments
* X-Total-Folders-Count - Total number of folders
| +**0** | Error | - | + +[[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) + +# **move_edu_resource** +> EduResource move_edu_resource(resource, edu_resource_move) + +Move an education resource + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_move import EduResourceMove +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + edu_resource_move = flat_api.EduResourceMove() # EduResourceMove | + + try: + # Move an education resource + api_response = api_instance.move_edu_resource(resource, edu_resource_move) + print("The response of EduResourcesApi->move_edu_resource:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->move_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + **edu_resource_move** | [**EduResourceMove**](EduResourceMove.md)| | + +### Return type + +[**EduResource**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **update_edu_resource** +> EduResource update_edu_resource(resource, edu_resource_update) + +Update an education resource metadata + +Update the metadata of a resource (e.g. its title). + +Use this method to rename education resources folders or assignments. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_update import EduResourceUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + edu_resource_update = flat_api.EduResourceUpdate() # EduResourceUpdate | + + try: + # Update an education resource metadata + api_response = api_instance.update_edu_resource(resource, edu_resource_update) + print("The response of EduResourcesApi->update_edu_resource:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->update_edu_resource: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + **edu_resource_update** | [**EduResourceUpdate**](EduResourceUpdate.md)| | + +### Return type + +[**EduResource**](EduResource.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **update_edu_resource_assignment** +> Assignment update_edu_resource_assignment(resource, assignment_update) + +Update an education resource assignment + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment import Assignment +from flat_api.models.assignment_update import AssignmentUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + assignment_update = flat_api.AssignmentUpdate() # AssignmentUpdate | + + try: + # Update an education resource assignment + api_response = api_instance.update_edu_resource_assignment(resource, assignment_update) + print("The response of EduResourcesApi->update_edu_resource_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->update_edu_resource_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + **assignment_update** | [**AssignmentUpdate**](AssignmentUpdate.md)| | + +### Return type + +[**Assignment**](Assignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Fetched resource | - | +**0** | Error | - | + +[[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) + +# **use_edu_resource_in_class** +> ClassAssignment use_edu_resource_in_class(resource, edu_resource_use_in_class) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.class_assignment import ClassAssignment +from flat_api.models.edu_resource_use_in_class import EduResourceUseInClass +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.EduResourcesApi(api_client) + resource = 'resource_example' # str | Unique identifier of the resource + edu_resource_use_in_class = flat_api.EduResourceUseInClass() # EduResourceUseInClass | + + try: + # Use an education resource in a class + api_response = api_instance.use_edu_resource_in_class(resource, edu_resource_use_in_class) + print("The response of EduResourcesApi->use_edu_resource_in_class:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EduResourcesApi->use_edu_resource_in_class: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| Unique identifier of the resource | + **edu_resource_use_in_class** | [**EduResourceUseInClass**](EduResourceUseInClass.md)| | + +### Return type + +[**ClassAssignment**](ClassAssignment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Assignment copied to the chosen class | - | +**0** | Error | - | + +[[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/reference/FlatErrorResponse.md b/docs/reference/FlatErrorResponse.md new file mode 100644 index 0000000..809122e --- /dev/null +++ b/docs/reference/FlatErrorResponse.md @@ -0,0 +1,34 @@ +# FlatErrorResponse + +An API Error response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | A corresponding code for this error | +**message** | **str** | A printable message for this error | +**id** | **str** | A unique error identifier generated for the request | [optional] +**param** | **str** | The related parameter that caused the error | [optional] +**provider_message** | **str** | 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] + +## Example + +```python +from flat_api.models.flat_error_response import FlatErrorResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of FlatErrorResponse from a JSON string +flat_error_response_instance = FlatErrorResponse.from_json(json) +# print the JSON string representation of the object +print(FlatErrorResponse.to_json()) + +# convert the object into a dict +flat_error_response_dict = flat_error_response_instance.to_dict() +# create an instance of FlatErrorResponse from a dict +flat_error_response_from_dict = FlatErrorResponse.from_dict(flat_error_response_dict) +``` +[[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/GoogleClassroomCoursework.md b/docs/reference/GoogleClassroomCoursework.md new file mode 100644 index 0000000..12f12b6 --- /dev/null +++ b/docs/reference/GoogleClassroomCoursework.md @@ -0,0 +1,33 @@ +# GoogleClassroomCoursework + +A coursework on Google Classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifier of the coursework assigned by Classroom | [optional] +**state** | **str** | State of the coursework | [optional] +**alternate_link** | **str** | Absolute link to this coursework in the Classroom web UI | [optional] +**topic_id** | **str** | Identifier of the topic where the assignment is created | [optional] + +## Example + +```python +from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework + +# TODO update the JSON string below +json = "{}" +# create an instance of GoogleClassroomCoursework from a JSON string +google_classroom_coursework_instance = GoogleClassroomCoursework.from_json(json) +# print the JSON string representation of the object +print(GoogleClassroomCoursework.to_json()) + +# convert the object into a dict +google_classroom_coursework_dict = google_classroom_coursework_instance.to_dict() +# create an instance of GoogleClassroomCoursework from a dict +google_classroom_coursework_from_dict = GoogleClassroomCoursework.from_dict(google_classroom_coursework_dict) +``` +[[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/GoogleClassroomSubmission.md b/docs/reference/GoogleClassroomSubmission.md new file mode 100644 index 0000000..644c04a --- /dev/null +++ b/docs/reference/GoogleClassroomSubmission.md @@ -0,0 +1,32 @@ +# GoogleClassroomSubmission + +A coursework submission on Google Classroom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifier of the coursework submission assigned by Classroom | +**state** | **str** | State of the submission on Google Classroom | +**alternate_link** | **str** | Absolute link to this coursework in the Classroom web UI | + +## Example + +```python +from flat_api.models.google_classroom_submission import GoogleClassroomSubmission + +# TODO update the JSON string below +json = "{}" +# create an instance of GoogleClassroomSubmission from a JSON string +google_classroom_submission_instance = GoogleClassroomSubmission.from_json(json) +# print the JSON string representation of the object +print(GoogleClassroomSubmission.to_json()) + +# convert the object into a dict +google_classroom_submission_dict = google_classroom_submission_instance.to_dict() +# create an instance of GoogleClassroomSubmission from a dict +google_classroom_submission_from_dict = GoogleClassroomSubmission.from_dict(google_classroom_submission_dict) +``` +[[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/Grade.md b/docs/reference/Grade.md new file mode 100644 index 0000000..43f0c6b --- /dev/null +++ b/docs/reference/Grade.md @@ -0,0 +1,35 @@ +# Grade + +Class grade of the resource + +## Enum + +* `ENUM_1` (value: `'1'`) + +* `ENUM_2` (value: `'2'`) + +* `ENUM_3` (value: `'3'`) + +* `ENUM_4` (value: `'4'`) + +* `ENUM_5` (value: `'5'`) + +* `ENUM_6` (value: `'6'`) + +* `ENUM_7` (value: `'7'`) + +* `ENUM_8` (value: `'8'`) + +* `ENUM_9` (value: `'9'`) + +* `ENUM_10` (value: `'10'`) + +* `ENUM_11` (value: `'11'`) + +* `ENUM_12` (value: `'12'`) + +* `UNIVERSITY` (value: `'university'`) + +[[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/Group.md b/docs/reference/Group.md similarity index 61% rename from docs/Group.md rename to docs/reference/Group.md index 6e25e3c..b065638 100644 --- a/docs/Group.md +++ b/docs/reference/Group.md @@ -1,16 +1,36 @@ # Group +A group of users + ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | The unique identifier of the group | [optional] **name** | **str** | The display name of the group | [optional] -**type** | **str** | 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 | [optional] +**type** | [**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** | **str** | 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] +## Example + +```python +from flat_api.models.group import Group + +# TODO update the JSON string below +json = "{}" +# create an instance of Group from a JSON string +group_instance = Group.from_json(json) +# print the JSON string representation of the object +print(Group.to_json()) + +# convert the object into a dict +group_dict = group_instance.to_dict() +# create an instance of Group from a dict +group_from_dict = Group.from_dict(group_dict) +``` [[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/GroupApi.md b/docs/reference/GroupApi.md new file mode 100644 index 0000000..477fa60 --- /dev/null +++ b/docs/reference/GroupApi.md @@ -0,0 +1,731 @@ +# flat_api.GroupApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_group_user**](GroupApi.md#add_group_user) | **POST** /groups/{group}/users | Add a student to a group +[**create_group**](GroupApi.md#create_group) | **POST** /groups | Create a new group +[**delete_group**](GroupApi.md#delete_group) | **DELETE** /groups/{group} | Delete a group +[**get_group_details**](GroupApi.md#get_group_details) | **GET** /groups/{group} | Get group information +[**get_group_scores**](GroupApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores +[**list_group_users**](GroupApi.md#list_group_users) | **GET** /groups/{group}/users | List group's users +[**list_groups**](GroupApi.md#list_groups) | **GET** /groups | List groups +[**remove_group_user**](GroupApi.md#remove_group_user) | **DELETE** /groups/{group}/users/{user} | Remove a student from a class group +[**rename_group**](GroupApi.md#rename_group) | **PUT** /groups/{group} | Rename a group + + +# **add_group_user** +> AddGroupUser200Response add_group_user(group, add_group_user_request) + +Add a student to a group + +Add a student to the specified group (must be in the same class) + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.add_group_user200_response import AddGroupUser200Response +from flat_api.models.add_group_user_request import AddGroupUserRequest +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + add_group_user_request = flat_api.AddGroupUserRequest() # AddGroupUserRequest | + + try: + # Add a student to a group + api_response = api_instance.add_group_user(group, add_group_user_request) + print("The response of GroupApi->add_group_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->add_group_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **add_group_user_request** | [**AddGroupUserRequest**](AddGroupUserRequest.md)| | + +### Return type + +[**AddGroupUser200Response**](AddGroupUser200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Membership created | - | +**400** | Bad Request - Invalid user ID or user not enrolled in class | - | +**403** | Forbidden - Insufficient permissions or invalid group type | - | +**404** | Not Found - Group not found or user not found | - | +**0** | Error | - | + +[[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) + +# **create_group** +> GroupDetails create_group(group_creation) + +Create a new group + +Create a group of the given type, tied to a classroom, optionally with initial members. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.group_creation import GroupCreation +from flat_api.models.group_details import GroupDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group_creation = flat_api.GroupCreation() # GroupCreation | + + try: + # Create a new group + api_response = api_instance.create_group(group_creation) + print("The response of GroupApi->create_group:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->create_group: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group_creation** | [**GroupCreation**](GroupCreation.md)| | + +### Return type + +[**GroupDetails**](GroupDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new group | - | +**400** | Bad Request - Invalid type or missing required parameters | - | +**403** | Forbidden - Insufficient permissions | - | +**409** | Conflict - Group name already exists | - | +**0** | Error | - | + +[[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) + +# **delete_group** +> delete_group(group) + +Delete a group + +Delete a group. Only available to teachers of the classroom. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + + try: + # Delete a group + api_instance.delete_group(group) + except Exception as e: + print("Exception when calling GroupApi->delete_group: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Group deleted | - | +**403** | Forbidden - Insufficient permissions or invalid group type | - | +**404** | Not Found - Group not found | - | +**0** | Error | - | + +[[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) + +# **get_group_details** +> GroupDetails get_group_details(group) + +Get group information + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.group_details import GroupDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + + try: + # Get group information + api_response = api_instance.get_group_details(group) + print("The response of GroupApi->get_group_details:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->get_group_details: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + +### Return type + +[**GroupDetails**](GroupDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The group details | - | +**404** | Not Found - Group not found or insufficient permissions | - | +**0** | Error | - | + +[[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) + +# **get_group_scores** +> List[ScoreDetails] get_group_scores(group, parent=parent) + +List group's scores + +Get the list of scores shared with a group. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + parent = 'parent_example' # str | Only return the scores forked from the score `parent` (optional) + + try: + # List group's scores + api_response = api_instance.get_group_scores(group, parent=parent) + print("The response of GroupApi->get_group_scores:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->get_group_scores: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **parent** | **str**| Only return the scores forked from the score `parent` | [optional] + +### Return type + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The group's scores | - | +**404** | Not Found - Group not found or user not member of group | - | +**0** | Error | - | + +[[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) + +# **list_group_users** +> List[UserPublic] list_group_users(group, source=source) + +List group's users + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_public import UserPublic +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + source = 'source_example' # str | Filter the users by their source (optional) + + try: + # List group's users + api_response = api_instance.list_group_users(group, source=source) + print("The response of GroupApi->list_group_users:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->list_group_users: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **source** | **str**| Filter the users by their source | [optional] + +### Return type + +[**List[UserPublic]**](UserPublic.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The users who are members of the group | - | +**404** | Not Found - Group not found or insufficient permissions | - | +**0** | Error | - | + +[[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) + +# **list_groups** +> List[GroupDetails] list_groups(type, classroom=classroom, assignment=assignment) + +List groups + +List all groups of a given type, filtered by either a classroom or an assignment. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.group_details import GroupDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + type = 'type_example' # str | + classroom = 'classroom_example' # str | Classroom ID to filter by (optional) + assignment = 'assignment_example' # str | Assignment ID to filter by (optional) + + try: + # List groups + api_response = api_instance.list_groups(type, classroom=classroom, assignment=assignment) + print("The response of GroupApi->list_groups:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->list_groups: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **type** | **str**| | + **classroom** | **str**| Classroom ID to filter by | [optional] + **assignment** | **str**| Assignment ID to filter by | [optional] + +### Return type + +[**List[GroupDetails]**](GroupDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of groups | - | +**400** | Bad Request - Invalid type or missing required parameters | - | +**403** | Forbidden - Insufficient permissions | - | +**404** | Not Found - Classroom or assignment not found | - | +**0** | Error | - | + +[[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) + +# **remove_group_user** +> remove_group_user(group, user) + +Remove a student from a class group + +Remove a student from a class group + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + user = 'user_example' # str | User ID + + try: + # Remove a student from a class group + api_instance.remove_group_user(group, user) + except Exception as e: + print("Exception when calling GroupApi->remove_group_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **user** | **str**| User ID | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Membership removed | - | +**403** | Forbidden - Insufficient permissions or invalid group type | - | +**404** | Not Found - Group not found or user not found | - | +**0** | Error | - | + +[[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) + +# **rename_group** +> GroupDetails rename_group(group, rename_group_request) + +Rename a group + +Rename a sub-group. Only available for class student groups. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.group_details import GroupDetails +from flat_api.models.rename_group_request import RenameGroupRequest +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.GroupApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + rename_group_request = flat_api.RenameGroupRequest() # RenameGroupRequest | + + try: + # Rename a group + api_response = api_instance.rename_group(group, rename_group_request) + print("The response of GroupApi->rename_group:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling GroupApi->rename_group: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **rename_group_request** | [**RenameGroupRequest**](RenameGroupRequest.md)| | + +### Return type + +[**GroupDetails**](GroupDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Updated group | - | +**400** | Bad Request - Invalid group ID or missing name | - | +**403** | Forbidden - Insufficient permissions | - | +**404** | Not Found - Group not found | - | +**409** | Conflict - Group name already exists | - | +**0** | Error | - | + +[[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/reference/GroupCreation.md b/docs/reference/GroupCreation.md new file mode 100644 index 0000000..bd2ca7d --- /dev/null +++ b/docs/reference/GroupCreation.md @@ -0,0 +1,32 @@ +# GroupCreation + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of group (currently only classStudentsSubGroup is supported) | +**classroom** | **str** | Classroom ID | +**name** | **str** | 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** | **List[str]** | Array of student IDs to add to the group | [optional] + +## Example + +```python +from flat_api.models.group_creation import GroupCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of GroupCreation from a JSON string +group_creation_instance = GroupCreation.from_json(json) +# print the JSON string representation of the object +print(GroupCreation.to_json()) + +# convert the object into a dict +group_creation_dict = group_creation_instance.to_dict() +# create an instance of GroupCreation from a dict +group_creation_from_dict = GroupCreation.from_dict(group_creation_dict) +``` +[[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/GroupDetails.md b/docs/reference/GroupDetails.md new file mode 100644 index 0000000..dbd1c0d --- /dev/null +++ b/docs/reference/GroupDetails.md @@ -0,0 +1,40 @@ +# GroupDetails + +The details of a group + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the group | +**name** | **str** | The displayable name of the group | +**type** | [**GroupType**](GroupType.md) | | +**organization** | **str** | The unique identifier of the Organization owning the group | [optional] +**classroom** | **str** | The unique identifier of the classroom owning the group. Only available for groups of type 'classStudentsSubGroup' or 'assignmentStudentsSubGroup' | [optional] +**assignment** | **str** | The unique identifier of the assignment owning the group. Only available for groups of type 'assignmentStudentsSubGroup'. | [optional] +**parent** | **str** | 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 created | +**users_count** | **float** | The number of students in this group | +**read_only** | **bool** | `true` if the properties and members of this group are read-only | +**tags** | **List[str]** | Tags for categorizing groups. * `edu:testing-students`: Marks this group as containing test student accounts | + +## Example + +```python +from flat_api.models.group_details import GroupDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of GroupDetails from a JSON string +group_details_instance = GroupDetails.from_json(json) +# print the JSON string representation of the object +print(GroupDetails.to_json()) + +# convert the object into a dict +group_details_dict = group_details_instance.to_dict() +# create an instance of GroupDetails from a dict +group_details_from_dict = GroupDetails.from_dict(group_details_dict) +``` +[[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/GroupType.md b/docs/reference/GroupType.md new file mode 100644 index 0000000..e8fe3fa --- /dev/null +++ b/docs/reference/GroupType.md @@ -0,0 +1,19 @@ +# GroupType + +The type of the group: * `generic`: A group created by a Flat user * `classTeachers`: A group created automatically by Flat that contains the teachers of a class * `classStudents`: A group created automatically by Flat that contains the students of a class * `classStudentsSubGroup`: Manually created sub-group of students of a class. * `assignmentStudentsSubGroup`: Manually created Sub-group of students of a class, in relation to a specific assignment. + +## Enum + +* `GENERIC` (value: `'generic'`) + +* `CLASSTEACHERS` (value: `'classTeachers'`) + +* `CLASSSTUDENTS` (value: `'classStudents'`) + +* `CLASSSTUDENTSSUBGROUP` (value: `'classStudentsSubGroup'`) + +* `ASSIGNMENTSTUDENTSSUBGROUP` (value: `'assignmentStudentsSubGroup'`) + +[[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/LicenseMode.md b/docs/reference/LicenseMode.md similarity index 62% rename from docs/LicenseMode.md rename to docs/reference/LicenseMode.md index af54571..266fa97 100644 --- a/docs/LicenseMode.md +++ b/docs/reference/LicenseMode.md @@ -1,8 +1,12 @@ # LicenseMode -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +Mode of the license + +## Enum + +* `CREDIT` (value: `'credit'`) + +* `SITE` (value: `'site'`) [[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/LicenseSources.md b/docs/reference/LicenseSources.md new file mode 100644 index 0000000..a487211 --- /dev/null +++ b/docs/reference/LicenseSources.md @@ -0,0 +1,25 @@ +# LicenseSources + +Source of the license + +## Enum + +* `ORDER` (value: `'order'`) + +* `TRIAL` (value: `'trial'`) + +* `VOUCHER` (value: `'voucher'`) + +* `DISTRIBUTOR` (value: `'distributor'`) + +* `SUBSCRIPTION` (value: `'subscription'`) + +* `APPSTORE` (value: `'appStore'`) + +* `PLAYSTORE` (value: `'playStore'`) + +* `MUSICFIRST` (value: `'musicfirst'`) + +[[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/LmsName.md b/docs/reference/LmsName.md new file mode 100644 index 0000000..5633b10 --- /dev/null +++ b/docs/reference/LmsName.md @@ -0,0 +1,25 @@ +# LmsName + +LMS name + +## Enum + +* `CANVAS` (value: `'canvas'`) + +* `MOODLE` (value: `'moodle'`) + +* `SCHOOLOGY` (value: `'schoology'`) + +* `BLACKBOARD` (value: `'blackboard'`) + +* `DESIRE2LEARN` (value: `'desire2learn'`) + +* `SAKAI` (value: `'sakai'`) + +* `SCHOOLBOX` (value: `'schoolbox'`) + +* `OTHER` (value: `'other'`) + +[[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/LtiConfiguration.md b/docs/reference/LtiConfiguration.md new file mode 100644 index 0000000..3b0b8d0 --- /dev/null +++ b/docs/reference/LtiConfiguration.md @@ -0,0 +1,64 @@ +# LtiConfiguration + +LTI configuration details (unified 1.1 and 1.3) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.3) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**consumer_key** | **str** | LTI 1.1 consumer key | [optional] +**consumer_secret** | **str** | LTI 1.1 consumer secret (only included for admins) | [optional] +**lms** | **str** | LMS type | [optional] +**name** | **str** | Configuration name | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**mode** | **str** | Dynamic registration LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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** | **str** | Parent configuration ID (for deployment-based configs) | [optional] +**deployment_key** | **str** | Deployment key (e.g., schoology, classlink) | [optional] +**deployment_breakdown_by** | **str** | Custom claim used for tenant identification (parent platforms only, read-only) | [optional] +**deployment_breakdown_id** | **str** | Value of the custom claim that identifies this specific tenant (child platforms only) | [optional] +**registration_token** | **str** | Only included for admins | [optional] +**registration_url** | **str** | 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] + +## Example + +```python +from flat_api.models.lti_configuration import LtiConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration from a JSON string +lti_configuration_instance = LtiConfiguration.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration.to_json()) + +# convert the object into a dict +lti_configuration_dict = lti_configuration_instance.to_dict() +# create an instance of LtiConfiguration from a dict +lti_configuration_from_dict = LtiConfiguration.from_dict(lti_configuration_dict) +``` +[[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/LtiConfiguration1p1.md b/docs/reference/LtiConfiguration1p1.md new file mode 100644 index 0000000..c520f80 --- /dev/null +++ b/docs/reference/LtiConfiguration1p1.md @@ -0,0 +1,41 @@ +# LtiConfiguration1p1 + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.1) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**consumer_key** | **str** | LTI 1.1 consumer key | [optional] +**consumer_secret** | **str** | LTI 1.1 consumer secret (only included for admins) | [optional] +**lms** | **str** | LMS type | [optional] +**name** | **str** | Configuration name | [optional] +**tool** | [**LtiConfiguration1p1AllOfTool**](LtiConfiguration1p1AllOfTool.md) | | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p1 import LtiConfiguration1p1 + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p1 from a JSON string +lti_configuration1p1_instance = LtiConfiguration1p1.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p1.to_json()) + +# convert the object into a dict +lti_configuration1p1_dict = lti_configuration1p1_instance.to_dict() +# create an instance of LtiConfiguration1p1 from a dict +lti_configuration1p1_from_dict = LtiConfiguration1p1.from_dict(lti_configuration1p1_dict) +``` +[[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/LtiConfiguration1p1AllOfTool.md b/docs/reference/LtiConfiguration1p1AllOfTool.md new file mode 100644 index 0000000..a201f6c --- /dev/null +++ b/docs/reference/LtiConfiguration1p1AllOfTool.md @@ -0,0 +1,35 @@ +# LtiConfiguration1p1AllOfTool + +Platform/tool product information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**product** | **str** | Product family code (e.g., canvas, moodle, schoology) | [optional] +**version** | **str** | Platform version string | [optional] +**instance_name** | **str** | Instance display name | [optional] +**instance_guid** | **str** | Unique instance identifier | [optional] +**instance_contact** | **str** | Contact email or handle for the instance | [optional] +**instance_domain** | **str** | Instance root domain | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p1AllOfTool from a JSON string +lti_configuration1p1_all_of_tool_instance = LtiConfiguration1p1AllOfTool.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p1AllOfTool.to_json()) + +# convert the object into a dict +lti_configuration1p1_all_of_tool_dict = lti_configuration1p1_all_of_tool_instance.to_dict() +# create an instance of LtiConfiguration1p1AllOfTool from a dict +lti_configuration1p1_all_of_tool_from_dict = LtiConfiguration1p1AllOfTool.from_dict(lti_configuration1p1_all_of_tool_dict) +``` +[[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/LtiConfiguration1p3.md b/docs/reference/LtiConfiguration1p3.md new file mode 100644 index 0000000..d777bae --- /dev/null +++ b/docs/reference/LtiConfiguration1p3.md @@ -0,0 +1,60 @@ +# LtiConfiguration1p3 + +LTI 1.3 configuration details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.3) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**mode** | **str** | Dynamic registration LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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** | **str** | Parent configuration ID (for deployment-based configs) | [optional] +**deployment_key** | **str** | Deployment key (e.g., schoology, classlink) | [optional] +**deployment_breakdown_by** | **str** | Custom claim used for tenant identification (parent platforms only, read-only) | [optional] +**deployment_breakdown_id** | **str** | Value of the custom claim that identifies this specific tenant (child platforms only) | [optional] +**registration_token** | **str** | Only included for admins | [optional] +**registration_url** | **str** | 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] + +## Example + +```python +from flat_api.models.lti_configuration1p3 import LtiConfiguration1p3 + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3 from a JSON string +lti_configuration1p3_instance = LtiConfiguration1p3.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3.to_json()) + +# convert the object into a dict +lti_configuration1p3_dict = lti_configuration1p3_instance.to_dict() +# create an instance of LtiConfiguration1p3 from a dict +lti_configuration1p3_from_dict = LtiConfiguration1p3.from_dict(lti_configuration1p3_dict) +``` +[[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/LtiConfiguration1p3Base.md b/docs/reference/LtiConfiguration1p3Base.md new file mode 100644 index 0000000..1985ac8 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3Base.md @@ -0,0 +1,43 @@ +# LtiConfiguration1p3Base + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base import LtiConfiguration1p3Base + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3Base from a JSON string +lti_configuration1p3_base_instance = LtiConfiguration1p3Base.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3Base.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_dict = lti_configuration1p3_base_instance.to_dict() +# create an instance of LtiConfiguration1p3Base from a dict +lti_configuration1p3_base_from_dict = LtiConfiguration1p3Base.from_dict(lti_configuration1p3_base_dict) +``` +[[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/LtiConfiguration1p3BaseSupportedServices.md b/docs/reference/LtiConfiguration1p3BaseSupportedServices.md new file mode 100644 index 0000000..89ed2d6 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3BaseSupportedServices.md @@ -0,0 +1,32 @@ +# LtiConfiguration1p3BaseSupportedServices + +LTI services support information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ags** | [**LtiConfiguration1p3BaseSupportedServicesAgs**](LtiConfiguration1p3BaseSupportedServicesAgs.md) | | [optional] +**nrps** | [**LtiConfiguration1p3BaseSupportedServicesNrps**](LtiConfiguration1p3BaseSupportedServicesNrps.md) | | [optional] +**deep_linking** | [**LtiConfiguration1p3BaseSupportedServicesDeepLinking**](LtiConfiguration1p3BaseSupportedServicesDeepLinking.md) | | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3BaseSupportedServices from a JSON string +lti_configuration1p3_base_supported_services_instance = LtiConfiguration1p3BaseSupportedServices.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3BaseSupportedServices.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_supported_services_dict = lti_configuration1p3_base_supported_services_instance.to_dict() +# create an instance of LtiConfiguration1p3BaseSupportedServices from a dict +lti_configuration1p3_base_supported_services_from_dict = LtiConfiguration1p3BaseSupportedServices.from_dict(lti_configuration1p3_base_supported_services_dict) +``` +[[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/LtiConfiguration1p3BaseSupportedServicesAgs.md b/docs/reference/LtiConfiguration1p3BaseSupportedServicesAgs.md new file mode 100644 index 0000000..4c65439 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3BaseSupportedServicesAgs.md @@ -0,0 +1,33 @@ +# LtiConfiguration1p3BaseSupportedServicesAgs + +Assignment and Grade Services support + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether AGS claims were detected in launches from this platform | [optional] +**version** | **str** | AGS version supported (e.g., \"2.0\") | [optional] +**enabled** | **bool** | Whether AGS is enabled for this platform | [optional] +**lineitems_url** | **str** | Base URL for line items operations as provided by the platform | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a JSON string +lti_configuration1p3_base_supported_services_ags_instance = LtiConfiguration1p3BaseSupportedServicesAgs.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3BaseSupportedServicesAgs.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_supported_services_ags_dict = lti_configuration1p3_base_supported_services_ags_instance.to_dict() +# create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a dict +lti_configuration1p3_base_supported_services_ags_from_dict = LtiConfiguration1p3BaseSupportedServicesAgs.from_dict(lti_configuration1p3_base_supported_services_ags_dict) +``` +[[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/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md b/docs/reference/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md new file mode 100644 index 0000000..16d363e --- /dev/null +++ b/docs/reference/LtiConfiguration1p3BaseSupportedServicesDeepLinking.md @@ -0,0 +1,31 @@ +# LtiConfiguration1p3BaseSupportedServicesDeepLinking + +Deep Linking support + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether Deep Linking claims were detected in launches from this platform | [optional] +**version** | **str** | Deep Linking version supported (e.g., \"2.0\") | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a JSON string +lti_configuration1p3_base_supported_services_deep_linking_instance = LtiConfiguration1p3BaseSupportedServicesDeepLinking.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3BaseSupportedServicesDeepLinking.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_supported_services_deep_linking_dict = lti_configuration1p3_base_supported_services_deep_linking_instance.to_dict() +# create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a dict +lti_configuration1p3_base_supported_services_deep_linking_from_dict = LtiConfiguration1p3BaseSupportedServicesDeepLinking.from_dict(lti_configuration1p3_base_supported_services_deep_linking_dict) +``` +[[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/LtiConfiguration1p3BaseSupportedServicesNrps.md b/docs/reference/LtiConfiguration1p3BaseSupportedServicesNrps.md new file mode 100644 index 0000000..5533062 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3BaseSupportedServicesNrps.md @@ -0,0 +1,32 @@ +# LtiConfiguration1p3BaseSupportedServicesNrps + +Names and Role Provisioning Services support + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **bool** | Whether NRPS claims were detected in launches from this platform | [optional] +**version** | **str** | NRPS version supported (e.g., \"2.0\") | [optional] +**enabled** | **bool** | Whether NRPS is enabled for this platform | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a JSON string +lti_configuration1p3_base_supported_services_nrps_instance = LtiConfiguration1p3BaseSupportedServicesNrps.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3BaseSupportedServicesNrps.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_supported_services_nrps_dict = lti_configuration1p3_base_supported_services_nrps_instance.to_dict() +# create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a dict +lti_configuration1p3_base_supported_services_nrps_from_dict = LtiConfiguration1p3BaseSupportedServicesNrps.from_dict(lti_configuration1p3_base_supported_services_nrps_dict) +``` +[[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/LtiConfiguration1p3BaseTool.md b/docs/reference/LtiConfiguration1p3BaseTool.md new file mode 100644 index 0000000..83b656c --- /dev/null +++ b/docs/reference/LtiConfiguration1p3BaseTool.md @@ -0,0 +1,35 @@ +# LtiConfiguration1p3BaseTool + +Platform/tool product information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**product** | **str** | Product family code (e.g., canvas, moodle, schoology) | [optional] +**version** | **str** | Platform version string | [optional] +**instance_name** | **str** | Instance name (e.g., 'My University Canvas') | [optional] +**instance_guid** | **str** | Unique instance identifier | [optional] +**instance_contact** | **str** | Contact email or handle for the instance | [optional] +**instance_domain** | **str** | Instance root domain | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3BaseTool from a JSON string +lti_configuration1p3_base_tool_instance = LtiConfiguration1p3BaseTool.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3BaseTool.to_json()) + +# convert the object into a dict +lti_configuration1p3_base_tool_dict = lti_configuration1p3_base_tool_instance.to_dict() +# create an instance of LtiConfiguration1p3BaseTool from a dict +lti_configuration1p3_base_tool_from_dict = LtiConfiguration1p3BaseTool.from_dict(lti_configuration1p3_base_tool_dict) +``` +[[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/LtiConfiguration1p3Deployment.md b/docs/reference/LtiConfiguration1p3Deployment.md new file mode 100644 index 0000000..8b0e22d --- /dev/null +++ b/docs/reference/LtiConfiguration1p3Deployment.md @@ -0,0 +1,55 @@ +# LtiConfiguration1p3Deployment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.3) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**mode** | **str** | Deployment-based LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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** | **str** | Parent configuration ID (for deployment-based configs) | [optional] +**deployment_key** | **str** | Deployment key (e.g., schoology, classlink) | [optional] +**deployment_breakdown_by** | **str** | Custom claim used for tenant identification (parent platforms only, read-only) | [optional] +**deployment_breakdown_id** | **str** | Value of the custom claim that identifies this specific tenant (child platforms only) | [optional] + +## Example + +```python +from flat_api.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3Deployment from a JSON string +lti_configuration1p3_deployment_instance = LtiConfiguration1p3Deployment.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3Deployment.to_json()) + +# convert the object into a dict +lti_configuration1p3_deployment_dict = lti_configuration1p3_deployment_instance.to_dict() +# create an instance of LtiConfiguration1p3Deployment from a dict +lti_configuration1p3_deployment_from_dict = LtiConfiguration1p3Deployment.from_dict(lti_configuration1p3_deployment_dict) +``` +[[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/LtiConfiguration1p3Dynamic.md b/docs/reference/LtiConfiguration1p3Dynamic.md new file mode 100644 index 0000000..fecb324 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3Dynamic.md @@ -0,0 +1,55 @@ +# LtiConfiguration1p3Dynamic + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.3) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**mode** | **str** | Dynamic registration LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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** | **str** | Only included for admins | [optional] +**registration_url** | **str** | 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] + +## Example + +```python +from flat_api.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3Dynamic from a JSON string +lti_configuration1p3_dynamic_instance = LtiConfiguration1p3Dynamic.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3Dynamic.to_json()) + +# convert the object into a dict +lti_configuration1p3_dynamic_dict = lti_configuration1p3_dynamic_instance.to_dict() +# create an instance of LtiConfiguration1p3Dynamic from a dict +lti_configuration1p3_dynamic_from_dict = LtiConfiguration1p3Dynamic.from_dict(lti_configuration1p3_dynamic_dict) +``` +[[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/LtiConfiguration1p3Manual.md b/docs/reference/LtiConfiguration1p3Manual.md new file mode 100644 index 0000000..4881a47 --- /dev/null +++ b/docs/reference/LtiConfiguration1p3Manual.md @@ -0,0 +1,51 @@ +# LtiConfiguration1p3Manual + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version (1.3) | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] +**mode** | **str** | Manual LTI 1.3 configuration mode | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment ID linking the tool to a tenant/class (varies by platform) | [optional] +**access_token_url** | **str** | OAuth2 token endpoint (for AGS/NRPS) | [optional] +**authorization_url** | **str** | OIDC authorization/login endpoint | [optional] +**jwks_url** | **str** | Platform JWKS endpoint (public keys) | [optional] +**deployment_mode** | **str** | Deployment mode (single for organization-specific, multi for shared parent platforms) | [optional] +**supported_services** | [**LtiConfiguration1p3BaseSupportedServices**](LtiConfiguration1p3BaseSupportedServices.md) | | [optional] +**tool** | [**LtiConfiguration1p3BaseTool**](LtiConfiguration1p3BaseTool.md) | | [optional] +**public_keyset_url** | **str** | Public keyset URL for the platform to retrieve Flat's public keys | [optional] +**initiate_login_url** | **str** | URL for the platform to initiate LTI login | [optional] +**redirect_uris** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfiguration1p3Manual from a JSON string +lti_configuration1p3_manual_instance = LtiConfiguration1p3Manual.from_json(json) +# print the JSON string representation of the object +print(LtiConfiguration1p3Manual.to_json()) + +# convert the object into a dict +lti_configuration1p3_manual_dict = lti_configuration1p3_manual_instance.to_dict() +# create an instance of LtiConfiguration1p3Manual from a dict +lti_configuration1p3_manual_from_dict = LtiConfiguration1p3Manual.from_dict(lti_configuration1p3_manual_dict) +``` +[[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/LtiConfigurationBase.md b/docs/reference/LtiConfigurationBase.md new file mode 100644 index 0000000..81d07d1 --- /dev/null +++ b/docs/reference/LtiConfigurationBase.md @@ -0,0 +1,36 @@ +# LtiConfigurationBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Configuration ID | +**lti_version** | **str** | LTI version | +**organization_id** | **str** | Organization ID | [optional] +**organization_name** | **str** | Organization name | [optional] +**creator_id** | **str** | 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** | **str** | Configuration status indicator | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_base import LtiConfigurationBase + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationBase from a JSON string +lti_configuration_base_instance = LtiConfigurationBase.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationBase.to_json()) + +# convert the object into a dict +lti_configuration_base_dict = lti_configuration_base_instance.to_dict() +# create an instance of LtiConfigurationBase from a dict +lti_configuration_base_from_dict = LtiConfigurationBase.from_dict(lti_configuration_base_dict) +``` +[[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/LtiConfigurationCreate.md b/docs/reference/LtiConfigurationCreate.md new file mode 100644 index 0000000..09299a2 --- /dev/null +++ b/docs/reference/LtiConfigurationCreate.md @@ -0,0 +1,44 @@ +# LtiConfigurationCreate + +Request to create a new LTI configuration (unified 1.1 and 1.3) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.3 manual creation mode | +**name** | **str** | Display name for LTI 1.1 credentials | [optional] +**lms** | **str** | LMS identifier for LTI 1.1 credentials | [optional] +**platform_info** | [**LtiConfigurationCreate1p3DynamicPlatformInfo**](LtiConfigurationCreate1p3DynamicPlatformInfo.md) | | [optional] +**locale** | **str** | Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code. | [optional] +**deployment_type** | **str** | Parent platform key (e.g., blackboard, schoology, classlink, manabipocket, manabipocket-stg) | +**deployment_id** | **str** | Deployment identifier provided by the platform | +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_breakdown_id** | **str** | Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology) | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**access_token_url** | **str** | Platform access token endpoint URL | [optional] +**authorization_url** | **str** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **str** | Platform JWKS endpoint URL for public keys | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create import LtiConfigurationCreate + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate from a JSON string +lti_configuration_create_instance = LtiConfigurationCreate.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate.to_json()) + +# convert the object into a dict +lti_configuration_create_dict = lti_configuration_create_instance.to_dict() +# create an instance of LtiConfigurationCreate from a dict +lti_configuration_create_from_dict = LtiConfigurationCreate.from_dict(lti_configuration_create_dict) +``` +[[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/LtiConfigurationCreate1p1.md b/docs/reference/LtiConfigurationCreate1p1.md new file mode 100644 index 0000000..72d285e --- /dev/null +++ b/docs/reference/LtiConfigurationCreate1p1.md @@ -0,0 +1,32 @@ +# LtiConfigurationCreate1p1 + +LTI 1.1 manual configuration creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.1 manual creation mode | +**name** | **str** | Display name for LTI 1.1 credentials | [optional] +**lms** | **str** | LMS identifier for LTI 1.1 credentials | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate1p1 from a JSON string +lti_configuration_create1p1_instance = LtiConfigurationCreate1p1.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate1p1.to_json()) + +# convert the object into a dict +lti_configuration_create1p1_dict = lti_configuration_create1p1_instance.to_dict() +# create an instance of LtiConfigurationCreate1p1 from a dict +lti_configuration_create1p1_from_dict = LtiConfigurationCreate1p1.from_dict(lti_configuration_create1p1_dict) +``` +[[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/LtiConfigurationCreate1p3Deployment.md b/docs/reference/LtiConfigurationCreate1p3Deployment.md new file mode 100644 index 0000000..fe274f2 --- /dev/null +++ b/docs/reference/LtiConfigurationCreate1p3Deployment.md @@ -0,0 +1,34 @@ +# LtiConfigurationCreate1p3Deployment + +LTI 1.3 deployment-based configuration creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.3 deployment-based creation mode | +**deployment_type** | **str** | Parent platform key (e.g., blackboard, schoology, classlink, manabipocket, manabipocket-stg) | +**deployment_id** | **str** | Deployment identifier provided by the platform | +**client_id** | **str** | OAuth2 client_id for the tenant; required for ClassLink deployments | [optional] +**deployment_breakdown_id** | **str** | Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology) | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate1p3Deployment from a JSON string +lti_configuration_create1p3_deployment_instance = LtiConfigurationCreate1p3Deployment.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate1p3Deployment.to_json()) + +# convert the object into a dict +lti_configuration_create1p3_deployment_dict = lti_configuration_create1p3_deployment_instance.to_dict() +# create an instance of LtiConfigurationCreate1p3Deployment from a dict +lti_configuration_create1p3_deployment_from_dict = LtiConfigurationCreate1p3Deployment.from_dict(lti_configuration_create1p3_deployment_dict) +``` +[[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/LtiConfigurationCreate1p3Dynamic.md b/docs/reference/LtiConfigurationCreate1p3Dynamic.md new file mode 100644 index 0000000..07c6d1c --- /dev/null +++ b/docs/reference/LtiConfigurationCreate1p3Dynamic.md @@ -0,0 +1,32 @@ +# LtiConfigurationCreate1p3Dynamic + +LTI 1.3 dynamic registration configuration creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.3 dynamic registration mode | +**platform_info** | [**LtiConfigurationCreate1p3DynamicPlatformInfo**](LtiConfigurationCreate1p3DynamicPlatformInfo.md) | | [optional] +**locale** | **str** | Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code. | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate1p3Dynamic from a JSON string +lti_configuration_create1p3_dynamic_instance = LtiConfigurationCreate1p3Dynamic.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate1p3Dynamic.to_json()) + +# convert the object into a dict +lti_configuration_create1p3_dynamic_dict = lti_configuration_create1p3_dynamic_instance.to_dict() +# create an instance of LtiConfigurationCreate1p3Dynamic from a dict +lti_configuration_create1p3_dynamic_from_dict = LtiConfigurationCreate1p3Dynamic.from_dict(lti_configuration_create1p3_dynamic_dict) +``` +[[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/LtiConfigurationCreate1p3DynamicPlatformInfo.md b/docs/reference/LtiConfigurationCreate1p3DynamicPlatformInfo.md new file mode 100644 index 0000000..7e8b0ae --- /dev/null +++ b/docs/reference/LtiConfigurationCreate1p3DynamicPlatformInfo.md @@ -0,0 +1,31 @@ +# LtiConfigurationCreate1p3DynamicPlatformInfo + +Optional platform information for dynamic registration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Platform display name | [optional] +**url** | **str** | Optional platform homepage or admin URL for reference | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a JSON string +lti_configuration_create1p3_dynamic_platform_info_instance = LtiConfigurationCreate1p3DynamicPlatformInfo.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate1p3DynamicPlatformInfo.to_json()) + +# convert the object into a dict +lti_configuration_create1p3_dynamic_platform_info_dict = lti_configuration_create1p3_dynamic_platform_info_instance.to_dict() +# create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a dict +lti_configuration_create1p3_dynamic_platform_info_from_dict = LtiConfigurationCreate1p3DynamicPlatformInfo.from_dict(lti_configuration_create1p3_dynamic_platform_info_dict) +``` +[[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/LtiConfigurationCreate1p3Manual.md b/docs/reference/LtiConfigurationCreate1p3Manual.md new file mode 100644 index 0000000..c2de4a4 --- /dev/null +++ b/docs/reference/LtiConfigurationCreate1p3Manual.md @@ -0,0 +1,38 @@ +# LtiConfigurationCreate1p3Manual + +LTI 1.3 manual configuration creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | LTI 1.3 manual creation mode | +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**deployment_id** | **str** | Deployment identifier provided by the platform | [optional] +**access_token_url** | **str** | Platform access token endpoint URL | [optional] +**authorization_url** | **str** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **str** | Platform JWKS endpoint URL for public keys | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationCreate1p3Manual from a JSON string +lti_configuration_create1p3_manual_instance = LtiConfigurationCreate1p3Manual.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationCreate1p3Manual.to_json()) + +# convert the object into a dict +lti_configuration_create1p3_manual_dict = lti_configuration_create1p3_manual_instance.to_dict() +# create an instance of LtiConfigurationCreate1p3Manual from a dict +lti_configuration_create1p3_manual_from_dict = LtiConfigurationCreate1p3Manual.from_dict(lti_configuration_create1p3_manual_dict) +``` +[[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/LtiConfigurationUpdate.md b/docs/reference/LtiConfigurationUpdate.md new file mode 100644 index 0000000..c68b899 --- /dev/null +++ b/docs/reference/LtiConfigurationUpdate.md @@ -0,0 +1,38 @@ +# LtiConfigurationUpdate + +Update an existing LTI 1.3 configuration (deployment clone or standalone) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **str** | Deployment identifier provided by the platform | [optional] +**deployment_breakdown_id** | **str** | Specific tenant identifier for multi-tenant platforms | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**access_token_url** | **str** | Platform access token endpoint URL | [optional] +**authorization_url** | **str** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **str** | Platform JWKS endpoint URL for public keys | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_update import LtiConfigurationUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationUpdate from a JSON string +lti_configuration_update_instance = LtiConfigurationUpdate.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationUpdate.to_json()) + +# convert the object into a dict +lti_configuration_update_dict = lti_configuration_update_instance.to_dict() +# create an instance of LtiConfigurationUpdate from a dict +lti_configuration_update_from_dict = LtiConfigurationUpdate.from_dict(lti_configuration_update_dict) +``` +[[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/LtiConfigurationUpdateDeployment.md b/docs/reference/LtiConfigurationUpdateDeployment.md new file mode 100644 index 0000000..5a2cda6 --- /dev/null +++ b/docs/reference/LtiConfigurationUpdateDeployment.md @@ -0,0 +1,32 @@ +# LtiConfigurationUpdateDeployment + +Update fields allowed for deployment-based configurations + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **str** | Deployment identifier provided by the platform | [optional] +**deployment_breakdown_id** | **str** | Specific tenant identifier for multi-tenant platforms | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationUpdateDeployment from a JSON string +lti_configuration_update_deployment_instance = LtiConfigurationUpdateDeployment.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationUpdateDeployment.to_json()) + +# convert the object into a dict +lti_configuration_update_deployment_dict = lti_configuration_update_deployment_instance.to_dict() +# create an instance of LtiConfigurationUpdateDeployment from a dict +lti_configuration_update_deployment_from_dict = LtiConfigurationUpdateDeployment.from_dict(lti_configuration_update_deployment_dict) +``` +[[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/LtiConfigurationUpdateStandalone.md b/docs/reference/LtiConfigurationUpdateStandalone.md new file mode 100644 index 0000000..4039a21 --- /dev/null +++ b/docs/reference/LtiConfigurationUpdateStandalone.md @@ -0,0 +1,37 @@ +# LtiConfigurationUpdateStandalone + +Update fields allowed for standalone (manual/dynamic) configurations + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**deployment_id** | **str** | Deployment identifier provided by the platform | [optional] +**platform_iss** | **str** | Platform issuer URL | [optional] +**platform_name** | **str** | Platform display name | [optional] +**client_id** | **str** | OAuth2 client_id allocated by the platform | [optional] +**access_token_url** | **str** | Platform access token endpoint URL | [optional] +**authorization_url** | **str** | Platform OIDC authorization endpoint URL | [optional] +**jwks_url** | **str** | Platform JWKS endpoint URL for public keys | [optional] +**enable_email_matching** | **bool** | Enable email-based user matching during LTI authentication | [optional] + +## Example + +```python +from flat_api.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiConfigurationUpdateStandalone from a JSON string +lti_configuration_update_standalone_instance = LtiConfigurationUpdateStandalone.from_json(json) +# print the JSON string representation of the object +print(LtiConfigurationUpdateStandalone.to_json()) + +# convert the object into a dict +lti_configuration_update_standalone_dict = lti_configuration_update_standalone_instance.to_dict() +# create an instance of LtiConfigurationUpdateStandalone from a dict +lti_configuration_update_standalone_from_dict = LtiConfigurationUpdateStandalone.from_dict(lti_configuration_update_standalone_dict) +``` +[[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/LtiCredentials.md b/docs/reference/LtiCredentials.md new file mode 100644 index 0000000..a7db849 --- /dev/null +++ b/docs/reference/LtiCredentials.md @@ -0,0 +1,39 @@ +# LtiCredentials + +A pair of LTI 1.1 OAuth credentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of this pair of credentials | [optional] +**name** | **str** | Name of the pair of credentials | [optional] +**lms** | [**LmsName**](LmsName.md) | | [optional] +**organization** | **str** | The unique identifier of the Organization associated to these credentials | [optional] +**creator** | **str** | Unique identifier of the user who created these credentials | [optional] +**creation_date** | **datetime** | The creation date of these credentials | [optional] +**last_usage** | **datetime** | The last time these credentials were used | [optional] +**consumer_key** | **str** | OAuth 1 Consumer Key | [optional] +**consumer_secret** | **str** | 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] + +## Example + +```python +from flat_api.models.lti_credentials import LtiCredentials + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiCredentials from a JSON string +lti_credentials_instance = LtiCredentials.from_json(json) +# print the JSON string representation of the object +print(LtiCredentials.to_json()) + +# convert the object into a dict +lti_credentials_dict = lti_credentials_instance.to_dict() +# create an instance of LtiCredentials from a dict +lti_credentials_from_dict = LtiCredentials.from_dict(lti_credentials_dict) +``` +[[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/LtiCredentialsCreation.md b/docs/reference/LtiCredentialsCreation.md new file mode 100644 index 0000000..41cf5f2 --- /dev/null +++ b/docs/reference/LtiCredentialsCreation.md @@ -0,0 +1,31 @@ +# LtiCredentialsCreation + +Creation of a pair of LTI 1.1 OAuth credentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of the pair of credentials | +**lms** | [**LmsName**](LmsName.md) | | + +## Example + +```python +from flat_api.models.lti_credentials_creation import LtiCredentialsCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of LtiCredentialsCreation from a JSON string +lti_credentials_creation_instance = LtiCredentialsCreation.from_json(json) +# print the JSON string representation of the object +print(LtiCredentialsCreation.to_json()) + +# convert the object into a dict +lti_credentials_creation_dict = lti_credentials_creation_instance.to_dict() +# create an instance of LtiCredentialsCreation from a dict +lti_credentials_creation_from_dict = LtiCredentialsCreation.from_dict(lti_credentials_creation_dict) +``` +[[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/MediaAttachment.md b/docs/reference/MediaAttachment.md new file mode 100644 index 0000000..502fad6 --- /dev/null +++ b/docs/reference/MediaAttachment.md @@ -0,0 +1,53 @@ +# MediaAttachment + +Media attachment. The API will automatically resolve the details, oEmbed, and media available if possible and return them in this object + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The resolved type of the attachment: * `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** | **str** | A unique Flat score identifier | [optional] +**revision** | **str** | A unique revision identifier of a score | [optional] +**worksheet** | **str** | A 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** | **str** | A unique track identifier | [optional] +**part_uuid** | **str** | The UUID of the instrument part selected for this attachment (for performance submissions) | [optional] +**sharing_mode** | [**MediaScoreSharingMode**](MediaScoreSharingMode.md) | | [optional] [default to MediaScoreSharingMode.READ] +**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** | **str** | The resolved title of the attachment | [optional] +**description** | **str** | The resolved description of the attachment | [optional] +**html** | **str** | 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** | **str** | The url of the attachment | [optional] +**thumbnail_url** | **str** | 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 height of the thumbnail | [optional] +**author_name** | **str** | The resolved author name of the attachment | [optional] +**author_url** | **str** | The resolved author url of the attachment | [optional] +**icon_url** | **str** | The URL of the icon | [optional] +**mime_type** | **str** | The MIME type of the file | [optional] +**google_drive_file_id** | **str** | 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] + +## Example + +```python +from flat_api.models.media_attachment import MediaAttachment + +# TODO update the JSON string below +json = "{}" +# create an instance of MediaAttachment from a JSON string +media_attachment_instance = MediaAttachment.from_json(json) +# print the JSON string representation of the object +print(MediaAttachment.to_json()) + +# convert the object into a dict +media_attachment_dict = media_attachment_instance.to_dict() +# create an instance of MediaAttachment from a dict +media_attachment_from_dict = MediaAttachment.from_dict(media_attachment_dict) +``` +[[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/MediaScoreSharingMode.md b/docs/reference/MediaScoreSharingMode.md new file mode 100644 index 0000000..4269686 --- /dev/null +++ b/docs/reference/MediaScoreSharingMode.md @@ -0,0 +1,17 @@ +# MediaScoreSharingMode + +The sharing mode of the score for classes post and assignments + +## Enum + +* `READ` (value: `'read'`) + +* `WRITE` (value: `'write'`) + +* `COPY` (value: `'copy'`) + +* `PERFORMANCE` (value: `'performance'`) + +[[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/MicrosoftGraphAssignment.md b/docs/reference/MicrosoftGraphAssignment.md new file mode 100644 index 0000000..1c522ce --- /dev/null +++ b/docs/reference/MicrosoftGraphAssignment.md @@ -0,0 +1,36 @@ +# MicrosoftGraphAssignment + +A Microsoft Teams assignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifier of the assignment assigned by Microsoft Teams | [optional] +**state** | **str** | 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** | **str** | 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** | **List[str]** | List of categories where this assignment is published under | [optional] +**assign_to_type** | **str** | 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** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.microsoft_graph_assignment import MicrosoftGraphAssignment + +# TODO update the JSON string below +json = "{}" +# create an instance of MicrosoftGraphAssignment from a JSON string +microsoft_graph_assignment_instance = MicrosoftGraphAssignment.from_json(json) +# print the JSON string representation of the object +print(MicrosoftGraphAssignment.to_json()) + +# convert the object into a dict +microsoft_graph_assignment_dict = microsoft_graph_assignment_instance.to_dict() +# create an instance of MicrosoftGraphAssignment from a dict +microsoft_graph_assignment_from_dict = MicrosoftGraphAssignment.from_dict(microsoft_graph_assignment_dict) +``` +[[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/MicrosoftGraphSubmission.md b/docs/reference/MicrosoftGraphSubmission.md new file mode 100644 index 0000000..c013c41 --- /dev/null +++ b/docs/reference/MicrosoftGraphSubmission.md @@ -0,0 +1,31 @@ +# MicrosoftGraphSubmission + +A Microsoft Teams submission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifier of the submission assigned by Microsoft Teams | +**state** | **str** | State of the submission | + +## Example + +```python +from flat_api.models.microsoft_graph_submission import MicrosoftGraphSubmission + +# TODO update the JSON string below +json = "{}" +# create an instance of MicrosoftGraphSubmission from a JSON string +microsoft_graph_submission_instance = MicrosoftGraphSubmission.from_json(json) +# print the JSON string representation of the object +print(MicrosoftGraphSubmission.to_json()) + +# convert the object into a dict +microsoft_graph_submission_dict = microsoft_graph_submission_instance.to_dict() +# create an instance of MicrosoftGraphSubmission from a dict +microsoft_graph_submission_from_dict = MicrosoftGraphSubmission.from_dict(microsoft_graph_submission_dict) +``` +[[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/OMRApi.md b/docs/reference/OMRApi.md new file mode 100644 index 0000000..55ec175 --- /dev/null +++ b/docs/reference/OMRApi.md @@ -0,0 +1,1056 @@ +# flat_api.OMRApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_omr_job_file**](OMRApi.md#add_omr_job_file) | **POST** /omr/jobs/{job}/files | Add a file to an OMR job +[**cancel_omr_job**](OMRApi.md#cancel_omr_job) | **POST** /omr/jobs/{job}/cancel | Cancel an OMR job +[**create_omr_job**](OMRApi.md#create_omr_job) | **POST** /omr/jobs | Create an OMR job +[**delete_omr_job**](OMRApi.md#delete_omr_job) | **DELETE** /omr/jobs/{job} | Delete an OMR job's data +[**get_omr_capabilities**](OMRApi.md#get_omr_capabilities) | **GET** /omr/capabilities | OMR capabilities and limits +[**get_omr_job**](OMRApi.md#get_omr_job) | **GET** /omr/jobs/{job} | Get an OMR job +[**get_omr_job_export**](OMRApi.md#get_omr_job_export) | **GET** /omr/jobs/{job}/exports/{format} | Download the finalized result +[**get_omr_job_file**](OMRApi.md#get_omr_job_file) | **GET** /omr/jobs/{job}/files/{index} | Get an input page image +[**list_billing_credits_history**](OMRApi.md#list_billing_credits_history) | **GET** /billing/credits/history | List credit history +[**list_omr_jobs**](OMRApi.md#list_omr_jobs) | **GET** /omr/jobs | List OMR jobs +[**start_omr_job**](OMRApi.md#start_omr_job) | **POST** /omr/jobs/{job}/start | Start an OMR job +[**submit_omr_job_step**](OMRApi.md#submit_omr_job_step) | **POST** /omr/jobs/{job}/steps/{step} | Submit an interactive step + + +# **add_omr_job_file** +> OmrJobFileUploadResult add_omr_job_file(job, omr_job_file_upload, x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job_file_upload import OmrJobFileUpload +from flat_api.models.omr_job_file_upload_result import OmrJobFileUploadResult +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + omr_job_file_upload = flat_api.OmrJobFileUpload() # OmrJobFileUpload | + x_flat_locale = 'fr' # str | 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) + + try: + # Add a file to an OMR job + api_response = api_instance.add_omr_job_file(job, omr_job_file_upload, x_flat_locale=x_flat_locale) + print("The response of OMRApi->add_omr_job_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->add_omr_job_file: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **omr_job_file_upload** | [**OmrJobFileUpload**](OmrJobFileUpload.md)| | + **x_flat_locale** | **str**| 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 + +[**OmrJobFileUploadResult**](OmrJobFileUploadResult.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | File added | - | +**409** | Job is not in draft state | - | +**0** | Error | - | + +[[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) + +# **cancel_omr_job** +> OmrJob cancel_omr_job(job, x_flat_locale=x_flat_locale) + +Cancel an OMR job + +Cancel a draft or in-flight job. Any charged credits are reversed. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + x_flat_locale = 'fr' # str | 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) + + try: + # Cancel an OMR job + api_response = api_instance.cancel_omr_job(job, x_flat_locale=x_flat_locale) + print("The response of OMRApi->cancel_omr_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->cancel_omr_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **x_flat_locale** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Canceled | - | +**0** | Error | - | + +[[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) + +# **create_omr_job** +> OmrJob create_omr_job(omr_job_creation, x_flat_locale=x_flat_locale) + +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. + +Pages are recognized in the orientation they are uploaded in. If your client does not +let the user rotate pages before upload, set `autoRotate: true` and the server corrects +pages uploaded sideways or upside down. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.models.omr_job_creation import OmrJobCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + omr_job_creation = flat_api.OmrJobCreation() # OmrJobCreation | + x_flat_locale = 'fr' # str | 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) + + try: + # Create an OMR job + api_response = api_instance.create_omr_job(omr_job_creation, x_flat_locale=x_flat_locale) + print("The response of OMRApi->create_omr_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->create_omr_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **omr_job_creation** | [**OmrJobCreation**](OmrJobCreation.md)| | + **x_flat_locale** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Draft created | - | +**202** | One-shot job started (files provided with autoStart) | - | +**402** | Account overquota or feature not included | - | +**0** | Error | - | + +[[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) + +# **delete_omr_job** +> OmrJob delete_omr_job(job, x_flat_locale=x_flat_locale) + +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 retention expiry: 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + x_flat_locale = 'fr' # str | 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) + + try: + # Delete an OMR job's data + api_response = api_instance.delete_omr_job(job, x_flat_locale=x_flat_locale) + print("The response of OMRApi->delete_omr_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->delete_omr_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **x_flat_locale** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Job data erased | - | +**403** | Not the owner of this job | - | +**404** | Job not found | - | +**409** | Job is not covered by the retention policy, or has not finished yet | - | +**0** | Error | - | + +[[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) + +# **get_omr_capabilities** +> OmrCapabilities get_omr_capabilities(x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_capabilities import OmrCapabilities +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + x_flat_locale = 'fr' # str | 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) + + try: + # OMR capabilities and limits + api_response = api_instance.get_omr_capabilities(x_flat_locale=x_flat_locale) + print("The response of OMRApi->get_omr_capabilities:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->get_omr_capabilities: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **x_flat_locale** | **str**| 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 + +[**OmrCapabilities**](OmrCapabilities.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Capabilities | - | +**0** | Error | - | + +[[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) + +# **get_omr_job** +> OmrJob get_omr_job(job, wait=wait, x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + wait = 56 # int | Long-poll up to this many seconds for a state change before returning. (optional) + x_flat_locale = 'fr' # str | 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) + + try: + # Get an OMR job + api_response = api_instance.get_omr_job(job, wait=wait, x_flat_locale=x_flat_locale) + print("The response of OMRApi->get_omr_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->get_omr_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| 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** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Job state | - | +**404** | Job not found | - | +**0** | Error | - | + +[[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) + +# **get_omr_job_export** +> bytes get_omr_job_export(job, format, x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + format = 'format_example' # str | 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' # str | 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) + + try: + # Download the finalized result + api_response = api_instance.get_omr_job_export(job, format, x_flat_locale=x_flat_locale) + print("The response of OMRApi->get_omr_job_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->get_omr_job_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **format** | **str**| 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** | **str**| 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 + +**bytes** + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/octet-stream, application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Exported file (content type depends on the requested format) | * Content-Disposition - Attachment disposition carrying the recommended filename, derived from the score's resolved work title (RFC 5987 encoded for non-ASCII titles). Clients should use this filename when saving the download.
| +**404** | Format not available for this job | - | +**409** | Job is not finished yet (`OMR_JOB_NOT_DONE`), or its files have been erased by the data retention policy (`OMR_JOB_EXPIRED`). | - | +**0** | Error | - | + +[[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) + +# **get_omr_job_file** +> bytes get_omr_job_file(job, index, x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + index = 56 # int | 0-based index of the input file (page) to fetch. + x_flat_locale = 'fr' # str | 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) + + try: + # Get an input page image + api_response = api_instance.get_omr_job_file(job, index, x_flat_locale=x_flat_locale) + print("The response of OMRApi->get_omr_job_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->get_omr_job_file: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **index** | **int**| 0-based index of the input file (page) to fetch. | + **x_flat_locale** | **str**| 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 + +**bytes** + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/jpeg, application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Page image | - | +**404** | Not found | - | +**409** | The job's files have been erased by the data retention policy | - | +**0** | Error | - | + +[[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) + +# **list_billing_credits_history** +> List[CreditTransaction] list_billing_credits_history(limit=limit, next=next, previous=previous) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.credit_transaction import CreditTransaction +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + limit = 50 # int | This is the maximum number of objects that may be returned (optional) (default to 50) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List credit history + api_response = api_instance.list_billing_credits_history(limit=limit, next=next, previous=previous) + print("The response of OMRApi->list_billing_credits_history:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->list_billing_credits_history: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] + **next** | **str**| 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** | **str**| 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 + +[**List[CreditTransaction]**](CreditTransaction.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of credit transactions | * Link - Pagination links (next, previous)
| +**0** | Error | - | + +[[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) + +# **list_omr_jobs** +> List[OmrJob] list_omr_jobs(status=status, expired=expired, limit=limit, next=next, previous=previous, x_flat_locale=x_flat_locale) + +List OMR jobs + +List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.models.omr_job_status import OmrJobStatus +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + status = flat_api.OmrJobStatus() # OmrJobStatus | Filter jobs by status (optional) + 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. (optional) + limit = 50 # int | This is the maximum number of objects that may be returned (optional) (default to 50) + next = 'next_example' # str | 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 = 'previous_example' # str | 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 = 'fr' # str | 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) + + try: + # List OMR jobs + api_response = api_instance.list_omr_jobs(status=status, expired=expired, limit=limit, next=next, previous=previous, x_flat_locale=x_flat_locale) + print("The response of OMRApi->list_omr_jobs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->list_omr_jobs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**OmrJobStatus**](.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** | **str**| 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** | **str**| 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** | **str**| 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 + +[**List[OmrJob]**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of OMR jobs | * Link - Pagination links (next, previous)
| +**0** | Error | - | + +[[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) + +# **start_omr_job** +> OmrJob start_omr_job(job, x_flat_locale=x_flat_locale) + +Start an OMR job + +Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_job import OmrJob +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + x_flat_locale = 'fr' # str | 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) + + try: + # Start an OMR job + api_response = api_instance.start_omr_job(job, x_flat_locale=x_flat_locale) + print("The response of OMRApi->start_omr_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->start_omr_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **x_flat_locale** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Processing started | - | +**400** | No files attached | - | +**402** | Insufficient credits or quota | - | +**0** | Error | - | + +[[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) + +# **submit_omr_job_step** +> OmrJob submit_omr_job_step(job, step, body, x_flat_locale=x_flat_locale) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.omr_details_submission import OmrDetailsSubmission +from flat_api.models.omr_job import OmrJob +from flat_api.models.omr_step_name import OmrStepName +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OMRApi(api_client) + job = 'job_example' # str | Unique identifier of the OMR job + step = flat_api.OmrStepName() # OmrStepName | The pending step being submitted + body = flat_api.OmrDetailsSubmission() # OmrDetailsSubmission | + x_flat_locale = 'fr' # str | 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) + + try: + # Submit an interactive step + api_response = api_instance.submit_omr_job_step(job, step, body, x_flat_locale=x_flat_locale) + print("The response of OMRApi->submit_omr_job_step:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OMRApi->submit_omr_job_step: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job** | **str**| Unique identifier of the OMR job | + **step** | [**OmrStepName**](.md)| The pending step being submitted | + **body** | **OmrDetailsSubmission**| | + **x_flat_locale** | **str**| 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 + +[**OmrJob**](OmrJob.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Step accepted, processing resumed | - | +**409** | Job is not awaiting this step | - | +**0** | Error | - | + +[[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/reference/OmrCapabilities.md b/docs/reference/OmrCapabilities.md new file mode 100644 index 0000000..a3b63c7 --- /dev/null +++ b/docs/reference/OmrCapabilities.md @@ -0,0 +1,43 @@ +# OmrCapabilities + +What the account or app can do, for client feature-detection. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**steps** | [**List[OmrStepName]**](OmrStepName.md) | Interactive steps this server supports. | +**formats** | **List[str]** | Export formats available via `getOmrJobExport`. | +**outputs** | [**List[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** | **List[str]** | 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** | **List[str]** | 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** | **List[str]** | 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** | [**List[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. | + +## Example + +```python +from flat_api.models.omr_capabilities import OmrCapabilities + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrCapabilities from a JSON string +omr_capabilities_instance = OmrCapabilities.from_json(json) +# print the JSON string representation of the object +print(OmrCapabilities.to_json()) + +# convert the object into a dict +omr_capabilities_dict = omr_capabilities_instance.to_dict() +# create an instance of OmrCapabilities from a dict +omr_capabilities_from_dict = OmrCapabilities.from_dict(omr_capabilities_dict) +``` +[[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/OmrDetailsStepData.md b/docs/reference/OmrDetailsStepData.md new file mode 100644 index 0000000..de48d4a --- /dev/null +++ b/docs/reference/OmrDetailsStepData.md @@ -0,0 +1,32 @@ +# OmrDetailsStepData + +Detected score details for the client to review before the score is built. `title` and `instruments` are detected from the input; the language is not detected and is not part of this payload (read the job's `locales`, set at creation). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | **str** | Discriminator for `OmrPendingStep.data`; always `details` for this payload. | +**title** | **str** | OCR-detected work title. | [optional] +**instruments** | [**List[OmrDetectedInstrument]**](OmrDetectedInstrument.md) | | + +## Example + +```python +from flat_api.models.omr_details_step_data import OmrDetailsStepData + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrDetailsStepData from a JSON string +omr_details_step_data_instance = OmrDetailsStepData.from_json(json) +# print the JSON string representation of the object +print(OmrDetailsStepData.to_json()) + +# convert the object into a dict +omr_details_step_data_dict = omr_details_step_data_instance.to_dict() +# create an instance of OmrDetailsStepData from a dict +omr_details_step_data_from_dict = OmrDetailsStepData.from_dict(omr_details_step_data_dict) +``` +[[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/OmrDetailsSubmission.md b/docs/reference/OmrDetailsSubmission.md new file mode 100644 index 0000000..9ccccf6 --- /dev/null +++ b/docs/reference/OmrDetailsSubmission.md @@ -0,0 +1,33 @@ +# OmrDetailsSubmission + +Overrides for the `details` step. Omitted fields keep the server's detected values. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | **str** | Discriminator for `OmrStepSubmission`; always `details` for this submission. | +**title** | **str** | Override the detected work title. | [optional] +**main_language** | **str** | 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** | [**List[OmrInstrumentOverride]**](OmrInstrumentOverride.md) | Per-part overrides, each matched to a detected part by `index`. | [optional] + +## Example + +```python +from flat_api.models.omr_details_submission import OmrDetailsSubmission + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrDetailsSubmission from a JSON string +omr_details_submission_instance = OmrDetailsSubmission.from_json(json) +# print the JSON string representation of the object +print(OmrDetailsSubmission.to_json()) + +# convert the object into a dict +omr_details_submission_dict = omr_details_submission_instance.to_dict() +# create an instance of OmrDetailsSubmission from a dict +omr_details_submission_from_dict = OmrDetailsSubmission.from_dict(omr_details_submission_dict) +``` +[[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/OmrDetectedInstrument.md b/docs/reference/OmrDetectedInstrument.md new file mode 100644 index 0000000..d50e44f --- /dev/null +++ b/docs/reference/OmrDetectedInstrument.md @@ -0,0 +1,36 @@ +# OmrDetectedInstrument + +One detected part. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | 0-based position of the part in the score. | +**part_name** | **str** | Verbatim part name read from the score. | [optional] +**instrument_id** | **str** | 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** | **str** | Localized display name, resolved server-side so the client needs no instruments dictionary. | [optional] +**midi_program** | **int** | General MIDI program number. | [optional] +**transpose_key** | **str** | Transposition or written key shown in the UI, for example `F` for Horn in F. | [optional] +**resolved_confidence** | **str** | Server confidence in the resolved instrument match. | [optional] + +## Example + +```python +from flat_api.models.omr_detected_instrument import OmrDetectedInstrument + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrDetectedInstrument from a JSON string +omr_detected_instrument_instance = OmrDetectedInstrument.from_json(json) +# print the JSON string representation of the object +print(OmrDetectedInstrument.to_json()) + +# convert the object into a dict +omr_detected_instrument_dict = omr_detected_instrument_instance.to_dict() +# create an instance of OmrDetectedInstrument from a dict +omr_detected_instrument_from_dict = OmrDetectedInstrument.from_dict(omr_detected_instrument_dict) +``` +[[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/OmrImportedMetadata.md b/docs/reference/OmrImportedMetadata.md new file mode 100644 index 0000000..e435e78 --- /dev/null +++ b/docs/reference/OmrImportedMetadata.md @@ -0,0 +1,33 @@ +# OmrImportedMetadata + +Metadata extracted from the recognized score. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**instruments** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.omr_imported_metadata import OmrImportedMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrImportedMetadata from a JSON string +omr_imported_metadata_instance = OmrImportedMetadata.from_json(json) +# print the JSON string representation of the object +print(OmrImportedMetadata.to_json()) + +# convert the object into a dict +omr_imported_metadata_dict = omr_imported_metadata_instance.to_dict() +# create an instance of OmrImportedMetadata from a dict +omr_imported_metadata_from_dict = OmrImportedMetadata.from_dict(omr_imported_metadata_dict) +``` +[[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/OmrInstrumentOverride.md b/docs/reference/OmrInstrumentOverride.md new file mode 100644 index 0000000..9ac242c --- /dev/null +++ b/docs/reference/OmrInstrumentOverride.md @@ -0,0 +1,34 @@ +# OmrInstrumentOverride + +Override for a single detected part, matched by `index`. Omitted fields keep the detected value. To set the instrument you may use **either** `instrumentId` (Flat's instrument id) **or** `midiProgram` (a standard General MIDI program) — whichever your integration prefers; you do not need both. If both are sent, `instrumentId` wins; otherwise `midiProgram` is resolved to the matching instrument; otherwise the detected instrument is kept. `transposeKey` and `partName` apply independently on top. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | 0-based position of the part to override, matching the `index` of the detected part. | +**instrument_id** | **str** | 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** | **str** | Override the part name. | [optional] +**transpose_key** | **str** | 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] + +## Example + +```python +from flat_api.models.omr_instrument_override import OmrInstrumentOverride + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrInstrumentOverride from a JSON string +omr_instrument_override_instance = OmrInstrumentOverride.from_json(json) +# print the JSON string representation of the object +print(OmrInstrumentOverride.to_json()) + +# convert the object into a dict +omr_instrument_override_dict = omr_instrument_override_instance.to_dict() +# create an instance of OmrInstrumentOverride from a dict +omr_instrument_override_from_dict = OmrInstrumentOverride.from_dict(omr_instrument_override_dict) +``` +[[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/OmrJob.md b/docs/reference/OmrJob.md new file mode 100644 index 0000000..ae9d558 --- /dev/null +++ b/docs/reference/OmrJob.md @@ -0,0 +1,46 @@ +# OmrJob + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the OMR job. | +**status** | [**OmrJobStatus**](OmrJobStatus.md) | | +**output** | [**OmrJobOutput**](OmrJobOutput.md) | | [default to OmrJobOutput.LIBRARY] +**interactive_steps** | [**List[OmrStepName]**](OmrStepName.md) | Steps this job pauses at for client input, echoing the value set at creation. | +**auto_rotate** | **bool** | Whether the job was created with `autoRotate`, echoing the value set at creation. | [optional] +**locales** | **List[str]** | 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** | [**OmrStepName**](OmrStepName.md) | The pending step when `status` is `awaitingInput`. Omitted otherwise. | [optional] +**pending_step** | [**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** | [**OmrJobProgress**](OmrJobProgress.md) | | [optional] +**original_file_metadata** | [**OmrJobFileMetadata**](OmrJobFileMetadata.md) | | [optional] +**imported_metadata** | [**OmrImportedMetadata**](OmrImportedMetadata.md) | | [optional] +**result** | [**OmrJobResult**](OmrJobResult.md) | | [optional] +**retention** | [**OmrJobRetention**](OmrJobRetention.md) | | [optional] +**error_code** | **str** | 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** | **str** | 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] + +## Example + +```python +from flat_api.models.omr_job import OmrJob + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJob from a JSON string +omr_job_instance = OmrJob.from_json(json) +# print the JSON string representation of the object +print(OmrJob.to_json()) + +# convert the object into a dict +omr_job_dict = omr_job_instance.to_dict() +# create an instance of OmrJob from a dict +omr_job_from_dict = OmrJob.from_dict(omr_job_dict) +``` +[[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/OmrJobCreation.md b/docs/reference/OmrJobCreation.md new file mode 100644 index 0000000..735e6ad --- /dev/null +++ b/docs/reference/OmrJobCreation.md @@ -0,0 +1,37 @@ +# OmrJobCreation + +Parameters to create an OMR job. Send without `files` to create a draft (then add files with `addOmrJobFile` and run `startOmrJob`), or include `files` and `autoStart: true` to import in a single request. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**output** | [**OmrJobOutput**](OmrJobOutput.md) | | [optional] [default to OmrJobOutput.LIBRARY] +**interactive_steps** | [**List[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 []] +**auto_rotate** | **bool** | Let the server detect and correct pages uploaded sideways or upside down (90/180/270°) before recognition. Off by default: pages are recognized in the orientation they are uploaded in, which is the right choice when your client lets the user rotate pages before upload. Enable it when it does not, for example a server-to-server integration importing scans as they come. Small tilt correction (a few degrees) always runs. | [optional] [default to False] +**locales** | **List[str]** | Locale hints (BCP 47) to improve text and lyric detection, for example `[\"ja\", \"en\"]`. The first entry is the primary reading language. This is the input hint; the main language can be confirmed or corrected at the `details` step. | [optional] +**collection** | **str** | Target collection ID. Only used when `output` is `library`. | [optional] +**idempotency_key** | **str** | 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** | [**List[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] + +## Example + +```python +from flat_api.models.omr_job_creation import OmrJobCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobCreation from a JSON string +omr_job_creation_instance = OmrJobCreation.from_json(json) +# print the JSON string representation of the object +print(OmrJobCreation.to_json()) + +# convert the object into a dict +omr_job_creation_dict = omr_job_creation_instance.to_dict() +# create an instance of OmrJobCreation from a dict +omr_job_creation_from_dict = OmrJobCreation.from_dict(omr_job_creation_dict) +``` +[[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/OmrJobFileMetadata.md b/docs/reference/OmrJobFileMetadata.md new file mode 100644 index 0000000..6c51447 --- /dev/null +++ b/docs/reference/OmrJobFileMetadata.md @@ -0,0 +1,35 @@ +# OmrJobFileMetadata + +Metadata about the uploaded input. + +## 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** | **str** | 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** | **str** | MIME type of the input (of the first file when several were combined). | [optional] +**file_extension** | **str** | File extension of the input, without the leading dot (for example `pdf`). | [optional] + +## Example + +```python +from flat_api.models.omr_job_file_metadata import OmrJobFileMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobFileMetadata from a JSON string +omr_job_file_metadata_instance = OmrJobFileMetadata.from_json(json) +# print the JSON string representation of the object +print(OmrJobFileMetadata.to_json()) + +# convert the object into a dict +omr_job_file_metadata_dict = omr_job_file_metadata_instance.to_dict() +# create an instance of OmrJobFileMetadata from a dict +omr_job_file_metadata_from_dict = OmrJobFileMetadata.from_dict(omr_job_file_metadata_dict) +``` +[[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/OmrJobFileUpload.md b/docs/reference/OmrJobFileUpload.md new file mode 100644 index 0000000..eef4135 --- /dev/null +++ b/docs/reference/OmrJobFileUpload.md @@ -0,0 +1,31 @@ +# OmrJobFileUpload + +One image or PDF added to a draft job. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | **bytes** | 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** | **str** | Optional original filename, kept for display. | [optional] + +## Example + +```python +from flat_api.models.omr_job_file_upload import OmrJobFileUpload + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobFileUpload from a JSON string +omr_job_file_upload_instance = OmrJobFileUpload.from_json(json) +# print the JSON string representation of the object +print(OmrJobFileUpload.to_json()) + +# convert the object into a dict +omr_job_file_upload_dict = omr_job_file_upload_instance.to_dict() +# create an instance of OmrJobFileUpload from a dict +omr_job_file_upload_from_dict = OmrJobFileUpload.from_dict(omr_job_file_upload_dict) +``` +[[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/OmrJobFileUploadResult.md b/docs/reference/OmrJobFileUploadResult.md new file mode 100644 index 0000000..cdf991e --- /dev/null +++ b/docs/reference/OmrJobFileUploadResult.md @@ -0,0 +1,31 @@ +# OmrJobFileUploadResult + +Result of adding a file to a draft job. + +## 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] + +## Example + +```python +from flat_api.models.omr_job_file_upload_result import OmrJobFileUploadResult + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobFileUploadResult from a JSON string +omr_job_file_upload_result_instance = OmrJobFileUploadResult.from_json(json) +# print the JSON string representation of the object +print(OmrJobFileUploadResult.to_json()) + +# convert the object into a dict +omr_job_file_upload_result_dict = omr_job_file_upload_result_instance.to_dict() +# create an instance of OmrJobFileUploadResult from a dict +omr_job_file_upload_result_from_dict = OmrJobFileUploadResult.from_dict(omr_job_file_upload_result_dict) +``` +[[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/OmrJobInputFile.md b/docs/reference/OmrJobInputFile.md new file mode 100644 index 0000000..fe74a57 --- /dev/null +++ b/docs/reference/OmrJobInputFile.md @@ -0,0 +1,31 @@ +# OmrJobInputFile + +A single image or PDF input, base64-encoded. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | **bytes** | 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** | **str** | Optional original filename, kept for display. | [optional] + +## Example + +```python +from flat_api.models.omr_job_input_file import OmrJobInputFile + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobInputFile from a JSON string +omr_job_input_file_instance = OmrJobInputFile.from_json(json) +# print the JSON string representation of the object +print(OmrJobInputFile.to_json()) + +# convert the object into a dict +omr_job_input_file_dict = omr_job_input_file_instance.to_dict() +# create an instance of OmrJobInputFile from a dict +omr_job_input_file_from_dict = OmrJobInputFile.from_dict(omr_job_input_file_dict) +``` +[[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/OmrJobOutput.md b/docs/reference/OmrJobOutput.md new file mode 100644 index 0000000..1275fba --- /dev/null +++ b/docs/reference/OmrJobOutput.md @@ -0,0 +1,13 @@ +# OmrJobOutput + +Where the result of the job goes. * `library`: import the result into the Flat Library and create a score (default). * `musicxml`: finalize the result only, downloadable via `getOmrJobExport`. No score is created, for third-party integrations that do not use the Library. + +## Enum + +* `LIBRARY` (value: `'library'`) + +* `MUSICXML` (value: `'musicxml'`) + +[[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/OmrJobProgress.md b/docs/reference/OmrJobProgress.md new file mode 100644 index 0000000..268f18b --- /dev/null +++ b/docs/reference/OmrJobProgress.md @@ -0,0 +1,32 @@ +# OmrJobProgress + +Live progress while the job is processing. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**percent** | **float** | Completion percentage (0-100). | [optional] +**text** | **str** | Localized progress message, ready to display. | [optional] +**key** | **str** | 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] + +## Example + +```python +from flat_api.models.omr_job_progress import OmrJobProgress + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobProgress from a JSON string +omr_job_progress_instance = OmrJobProgress.from_json(json) +# print the JSON string representation of the object +print(OmrJobProgress.to_json()) + +# convert the object into a dict +omr_job_progress_dict = omr_job_progress_instance.to_dict() +# create an instance of OmrJobProgress from a dict +omr_job_progress_from_dict = OmrJobProgress.from_dict(omr_job_progress_dict) +``` +[[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/OmrJobResult.md b/docs/reference/OmrJobResult.md new file mode 100644 index 0000000..534695d --- /dev/null +++ b/docs/reference/OmrJobResult.md @@ -0,0 +1,31 @@ +# OmrJobResult + +The outcome of a finished job. Present when `status` is `done`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score** | **str** | Created score ID, when `output` is `library`. | [optional] +**exports** | **List[str]** | Formats available via `getOmrJobExport`, for example `[\"musicxml\", \"mxl\", \"midi\"]`. | [optional] + +## Example + +```python +from flat_api.models.omr_job_result import OmrJobResult + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobResult from a JSON string +omr_job_result_instance = OmrJobResult.from_json(json) +# print the JSON string representation of the object +print(OmrJobResult.to_json()) + +# convert the object into a dict +omr_job_result_dict = omr_job_result_instance.to_dict() +# create an instance of OmrJobResult from a dict +omr_job_result_from_dict = OmrJobResult.from_dict(omr_job_result_dict) +``` +[[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/OmrJobRetention.md b/docs/reference/OmrJobRetention.md new file mode 100644 index 0000000..065b250 --- /dev/null +++ b/docs/reference/OmrJobRetention.md @@ -0,0 +1,31 @@ +# OmrJobRetention + +Data-retention state of the job. Present only on jobs whose `output` is `musicxml`. Jobs imported into the Flat library are part of your library content, are not covered by this policy, and omit this object entirely. Erasure happens shortly after `expiryDate` rather than exactly on it. Plan for the deadline, not the instant. + +## 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] + +## Example + +```python +from flat_api.models.omr_job_retention import OmrJobRetention + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrJobRetention from a JSON string +omr_job_retention_instance = OmrJobRetention.from_json(json) +# print the JSON string representation of the object +print(OmrJobRetention.to_json()) + +# convert the object into a dict +omr_job_retention_dict = omr_job_retention_instance.to_dict() +# create an instance of OmrJobRetention from a dict +omr_job_retention_from_dict = OmrJobRetention.from_dict(omr_job_retention_dict) +``` +[[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/OmrJobStatus.md b/docs/reference/OmrJobStatus.md new file mode 100644 index 0000000..67761d4 --- /dev/null +++ b/docs/reference/OmrJobStatus.md @@ -0,0 +1,21 @@ +# OmrJobStatus + +Status of the job. * `draft`: created, files can still be added; not yet started or charged. * `processing`: the pipeline is running. * `awaitingInput`: paused on the `currentStep`, waiting for the client to submit it. * `done`: finished. See `result`. * `error`: failed. See `errorCode`. * `canceled`: canceled by the client. + +## Enum + +* `DRAFT` (value: `'draft'`) + +* `PROCESSING` (value: `'processing'`) + +* `AWAITINGINPUT` (value: `'awaitingInput'`) + +* `DONE` (value: `'done'`) + +* `ERROR` (value: `'error'`) + +* `CANCELED` (value: `'canceled'`) + +[[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/OmrLocaleDetails.md b/docs/reference/OmrLocaleDetails.md new file mode 100644 index 0000000..601aa3a --- /dev/null +++ b/docs/reference/OmrLocaleDetails.md @@ -0,0 +1,31 @@ +# OmrLocaleDetails + +An OCR-selectable locale with its English name. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | BCP 47 locale code. Always one of the codes listed in `locales`. | +**name** | **str** | English name of the language, for display in a picker. | + +## Example + +```python +from flat_api.models.omr_locale_details import OmrLocaleDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrLocaleDetails from a JSON string +omr_locale_details_instance = OmrLocaleDetails.from_json(json) +# print the JSON string representation of the object +print(OmrLocaleDetails.to_json()) + +# convert the object into a dict +omr_locale_details_dict = omr_locale_details_instance.to_dict() +# create an instance of OmrLocaleDetails from a dict +omr_locale_details_from_dict = OmrLocaleDetails.from_dict(omr_locale_details_dict) +``` +[[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/OmrPendingStep.md b/docs/reference/OmrPendingStep.md new file mode 100644 index 0000000..147c1fe --- /dev/null +++ b/docs/reference/OmrPendingStep.md @@ -0,0 +1,31 @@ +# OmrPendingStep + +The step currently awaiting client input. The `data` shape is keyed by `step`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**step** | [**OmrStepName**](OmrStepName.md) | | +**data** | [**OmrDetailsStepData**](OmrDetailsStepData.md) | | + +## Example + +```python +from flat_api.models.omr_pending_step import OmrPendingStep + +# TODO update the JSON string below +json = "{}" +# create an instance of OmrPendingStep from a JSON string +omr_pending_step_instance = OmrPendingStep.from_json(json) +# print the JSON string representation of the object +print(OmrPendingStep.to_json()) + +# convert the object into a dict +omr_pending_step_dict = omr_pending_step_instance.to_dict() +# create an instance of OmrPendingStep from a dict +omr_pending_step_from_dict = OmrPendingStep.from_dict(omr_pending_step_dict) +``` +[[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/OmrStepName.md b/docs/reference/OmrStepName.md new file mode 100644 index 0000000..2b50d4f --- /dev/null +++ b/docs/reference/OmrStepName.md @@ -0,0 +1,11 @@ +# OmrStepName + +Interactive pipeline step. Forward-compatible: new values may be added over time. Only steps a client lists in `interactiveSteps` can pause that client's job; any step a client does not list (including future ones) is auto-resolved by the server. * `details`: confirm or adjust the detected title, main language and instruments before the score is built. Resuming from this step is fast: note recognition is already done and is not run again. + +## Enum + +* `DETAILS` (value: `'details'`) + +[[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/OrganizationApi.md b/docs/reference/OrganizationApi.md new file mode 100644 index 0000000..9409814 --- /dev/null +++ b/docs/reference/OrganizationApi.md @@ -0,0 +1,1350 @@ +# flat_api.OrganizationApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**count_orga_users**](OrganizationApi.md#count_orga_users) | **GET** /organizations/users/count | Count the organization users using the provided filters +[**create_lti_configuration**](OrganizationApi.md#create_lti_configuration) | **POST** /organizations/lti/configurations | Create a new LTI configuration (1.1 or 1.3) +[**create_lti_credentials**](OrganizationApi.md#create_lti_credentials) | **POST** /organizations/lti/credentials | Create a new pair of LTI 1.1 credentials +[**create_organization_invitation**](OrganizationApi.md#create_organization_invitation) | **POST** /organizations/invitations | Create a new invitation to join the organization +[**create_organization_user**](OrganizationApi.md#create_organization_user) | **POST** /organizations/users | Create a new user account +[**create_organization_user_access_token**](OrganizationApi.md#create_organization_user_access_token) | **POST** /organizations/users/{user}/accessToken | Create a delegated API access token for an organization user +[**create_organization_user_signin_link**](OrganizationApi.md#create_organization_user_signin_link) | **POST** /organizations/users/{user}/signinLink | Create a sign in link for an organization user +[**delete_lti_configuration**](OrganizationApi.md#delete_lti_configuration) | **DELETE** /organizations/lti/configurations/{configuration} | Delete an LTI configuration +[**list_lti_configurations**](OrganizationApi.md#list_lti_configurations) | **GET** /organizations/lti/configurations | List LTI configurations (1.1 and 1.3) +[**list_lti_credentials**](OrganizationApi.md#list_lti_credentials) | **GET** /organizations/lti/credentials | List LTI 1.x credentials +[**list_organization_invitations**](OrganizationApi.md#list_organization_invitations) | **GET** /organizations/invitations | List the organization invitations +[**list_organization_users**](OrganizationApi.md#list_organization_users) | **GET** /organizations/users | List the organization users +[**remove_organization_invitation**](OrganizationApi.md#remove_organization_invitation) | **DELETE** /organizations/invitations/{invitation} | Remove an organization invitation +[**remove_organization_user**](OrganizationApi.md#remove_organization_user) | **DELETE** /organizations/users/{user} | Remove an account from Flat +[**revoke_lti_credentials**](OrganizationApi.md#revoke_lti_credentials) | **DELETE** /organizations/lti/credentials/{credentials} | Revoke LTI 1.x credentials +[**update_lti_configuration**](OrganizationApi.md#update_lti_configuration) | **PUT** /organizations/lti/configurations/{configuration} | Update an existing LTI configuration (edit 1.3; 1.1 not editable) +[**update_organization_user**](OrganizationApi.md#update_organization_user) | **PUT** /organizations/users/{user} | Update account information + + +# **count_orga_users** +> int count_orga_users(role=role, q=q, group=group, no_active_license=no_active_license, test_accounts=test_accounts) + +Count the organization users using the provided filters + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + role = ['role_example'] # List[str] | Filter users by role (optional) + q = 'q_example' # str | The query to search (optional) + group = ['group_example'] # List[str] | Filter users by group (optional) + no_active_license = True # bool | Filter users who don't have an active license (optional) + test_accounts = 'test_accounts_example' # str | 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) + + try: + # Count the organization users using the provided filters + api_response = api_instance.count_orga_users(role=role, q=q, group=group, no_active_license=no_active_license, test_accounts=test_accounts) + print("The response of OrganizationApi->count_orga_users:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->count_orga_users: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **role** | [**List[str]**](str.md)| Filter users by role | [optional] + **q** | **str**| The query to search | [optional] + **group** | [**List[str]**](str.md)| Filter users by group | [optional] + **no_active_license** | **bool**| Filter users who don't have an active license | [optional] + **test_accounts** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Number of users | - | +**0** | Error | - | + +[[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) + +# **create_lti_configuration** +> LtiConfiguration create_lti_configuration(lti_configuration_create) + +Create a new LTI configuration (1.1 or 1.3) + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.lti_configuration import LtiConfiguration +from flat_api.models.lti_configuration_create import LtiConfigurationCreate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + lti_configuration_create = flat_api.LtiConfigurationCreate() # LtiConfigurationCreate | + + try: + # Create a new LTI configuration (1.1 or 1.3) + api_response = api_instance.create_lti_configuration(lti_configuration_create) + print("The response of OrganizationApi->create_lti_configuration:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_lti_configuration: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **lti_configuration_create** | [**LtiConfigurationCreate**](LtiConfigurationCreate.md)| | + +### Return type + +[**LtiConfiguration**](LtiConfiguration.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The created LTI configuration | - | +**0** | Error | - | + +[[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) + +# **create_lti_credentials** +> LtiCredentials create_lti_credentials(body) + +Create a new pair of LTI 1.1 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.lti_credentials import LtiCredentials +from flat_api.models.lti_credentials_creation import LtiCredentialsCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + body = flat_api.LtiCredentialsCreation() # LtiCredentialsCreation | + + try: + # Create a new pair of LTI 1.1 credentials + api_response = api_instance.create_lti_credentials(body) + print("The response of OrganizationApi->create_lti_credentials:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_lti_credentials: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**LtiCredentialsCreation**](LtiCredentialsCreation.md)| | + +### Return type + +[**LtiCredentials**](LtiCredentials.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The LTI Credentials | - | +**403** | Not admin of an organization | - | +**0** | Error | - | + +[[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) + +# **create_organization_invitation** +> OrganizationInvitation create_organization_invitation(body) + +Create a new invitation to join the organization + +This method creates and sends an 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 unique identifier of the corresponding user. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.organization_invitation import OrganizationInvitation +from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + body = flat_api.OrganizationInvitationCreation() # OrganizationInvitationCreation | + + try: + # Create a new invitation to join the organization + api_response = api_instance.create_organization_invitation(body) + print("The response of OrganizationApi->create_organization_invitation:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_organization_invitation: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OrganizationInvitationCreation**](OrganizationInvitationCreation.md)| | + +### Return type + +[**OrganizationInvitation**](OrganizationInvitation.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | New invitation created | - | +**0** | Error | - | + +[[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) + +# **create_organization_user** +> UserDetailsAdmin create_organization_user(body) + +Create a new user account + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_creation import UserCreation +from flat_api.models.user_details_admin import UserDetailsAdmin +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + body = flat_api.UserCreation() # UserCreation | + + try: + # Create a new user account + api_response = api_instance.create_organization_user(body) + print("The response of OrganizationApi->create_organization_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_organization_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**UserCreation**](UserCreation.md)| | + +### Return type + +[**UserDetailsAdmin**](UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | New user created | - | +**0** | Error | - | + +[[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) + +# **create_organization_user_access_token** +> ApiAccessToken create_organization_user_access_token(user, organization_user_access_token_creation) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.api_access_token import ApiAccessToken +from flat_api.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + user = 'user_example' # str | Unique identifier of the Flat account + organization_user_access_token_creation = flat_api.OrganizationUserAccessTokenCreation() # OrganizationUserAccessTokenCreation | + + try: + # Create a delegated API access token for an organization user + api_response = api_instance.create_organization_user_access_token(user, organization_user_access_token_creation) + print("The response of OrganizationApi->create_organization_user_access_token:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_organization_user_access_token: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| Unique identifier of the Flat account | + **organization_user_access_token_creation** | [**OrganizationUserAccessTokenCreation**](OrganizationUserAccessTokenCreation.md)| | + +### Return type + +[**ApiAccessToken**](ApiAccessToken.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Created API access token | - | +**0** | Error | - | + +[[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) + +# **create_organization_user_signin_link** +> UserSigninLink create_organization_user_signin_link(user, user_signin_link_creation) + +Create a sign in link for an organization user + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_signin_link import UserSigninLink +from flat_api.models.user_signin_link_creation import UserSigninLinkCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + user = 'user_example' # str | Unique identifier of the Flat account + user_signin_link_creation = flat_api.UserSigninLinkCreation() # UserSigninLinkCreation | + + try: + # Create a sign in link for an organization user + api_response = api_instance.create_organization_user_signin_link(user, user_signin_link_creation) + print("The response of OrganizationApi->create_organization_user_signin_link:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->create_organization_user_signin_link: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| Unique identifier of the Flat account | + **user_signin_link_creation** | [**UserSigninLinkCreation**](UserSigninLinkCreation.md)| | + +### Return type + +[**UserSigninLink**](UserSigninLink.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Sign in link | - | +**0** | Error | - | + +[[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) + +# **delete_lti_configuration** +> delete_lti_configuration(configuration) + +Delete an LTI configuration + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + configuration = 'configuration_example' # str | Configuration unique identifier + + try: + # Delete an LTI configuration + api_instance.delete_lti_configuration(configuration) + except Exception as e: + print("Exception when calling OrganizationApi->delete_lti_configuration: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **configuration** | **str**| Configuration unique identifier | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Configuration deleted | - | +**0** | Error | - | + +[[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) + +# **list_lti_configurations** +> List[LtiConfiguration] list_lti_configurations() + +List LTI configurations (1.1 and 1.3) + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.lti_configuration import LtiConfiguration +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + + try: + # List LTI configurations (1.1 and 1.3) + api_response = api_instance.list_lti_configurations() + print("The response of OrganizationApi->list_lti_configurations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->list_lti_configurations: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**List[LtiConfiguration]**](LtiConfiguration.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The list of LTI configurations for the caller's organization | - | +**0** | Error | - | + +[[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) + +# **list_lti_credentials** +> List[LtiCredentials] list_lti_credentials() + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.lti_credentials import LtiCredentials +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + + try: + # List LTI 1.x credentials + api_response = api_instance.list_lti_credentials() + print("The response of OrganizationApi->list_lti_credentials:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->list_lti_credentials: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**List[LtiCredentials]**](LtiCredentials.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The list of LTI Credentials | - | +**403** | Not admin of an organization | - | +**0** | Error | - | + +[[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) + +# **list_organization_invitations** +> List[OrganizationInvitation] list_organization_invitations(role=role, limit=limit, next=next, previous=previous) + +List the organization invitations + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.organization_invitation import OrganizationInvitation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + role = 'role_example' # str | Filter users by role (optional) + limit = 50 # int | This is the maximum number of objects that may be returned (optional) (default to 50) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List the organization invitations + api_response = api_instance.list_organization_invitations(role=role, limit=limit, next=next, previous=previous) + print("The response of OrganizationApi->list_organization_invitations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->list_organization_invitations: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **role** | **str**| Filter users by role | [optional] + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 50] + **next** | **str**| 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** | **str**| 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 + +[**List[OrganizationInvitation]**](OrganizationInvitation.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of invitations | - | +**0** | Error | - | + +[[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) + +# **list_organization_users** +> List[UserDetailsAdmin] list_organization_users(sort=sort, direction=direction, next=next, previous=previous, role=role, q=q, group=group, no_active_license=no_active_license, test_accounts=test_accounts, license_expiration_date=license_expiration_date, only_ids=only_ids, limit=limit) + +List the organization users + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_details_admin import UserDetailsAdmin +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + sort = 'sort_example' # str | 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 = 'direction_example' # str | Sort direction (optional) + next = 'next_example' # str | 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 = 'previous_example' # str | 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 = ['role_example'] # List[str] | Filter users by role (optional) + q = 'q_example' # str | The query to search (optional) + group = ['group_example'] # List[str] | Filter users by group (optional) + no_active_license = True # bool | Filter users who don't have an active license (optional) + test_accounts = 'test_accounts_example' # str | 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 = ['license_expiration_date_example'] # List[str] | Filter users by license expiration date or `active` / `notActive` (optional) + only_ids = True # bool | Return only user ids (optional) + limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + + try: + # List the organization users + api_response = api_instance.list_organization_users(sort=sort, direction=direction, next=next, previous=previous, role=role, q=q, group=group, no_active_license=no_active_license, test_accounts=test_accounts, license_expiration_date=license_expiration_date, only_ids=only_ids, limit=limit) + print("The response of OrganizationApi->list_organization_users:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->list_organization_users: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sort** | **str**| 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** | **str**| Sort direction | [optional] + **next** | **str**| 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** | **str**| 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** | [**List[str]**](str.md)| Filter users by role | [optional] + **q** | **str**| The query to search | [optional] + **group** | [**List[str]**](str.md)| Filter users by group | [optional] + **no_active_license** | **bool**| Filter users who don't have an active license | [optional] + **test_accounts** | **str**| 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** | [**List[str]**](str.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 + +[**List[UserDetailsAdmin]**](UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of users | - | +**0** | Error | - | + +[[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) + +# **remove_organization_invitation** +> remove_organization_invitation(invitation) + +Remove an organization invitation + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + invitation = 'invitation_example' # str | Unique identifier of the invitation + + try: + # Remove an organization invitation + api_instance.remove_organization_invitation(invitation) + except Exception as e: + print("Exception when calling OrganizationApi->remove_organization_invitation: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **invitation** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The invitation has been removed | - | +**0** | Error | - | + +[[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) + +# **remove_organization_user** +> remove_organization_user(user, convert_to_individual=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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + user = 'user_example' # str | 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. (optional) + + try: + # Remove an account from Flat + api_instance.remove_organization_user(user, convert_to_individual=convert_to_individual) + except Exception as e: + print("Exception when calling OrganizationApi->remove_organization_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | User deleted | - | +**0** | Error | - | + +[[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) + +# **revoke_lti_credentials** +> revoke_lti_credentials(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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + credentials = 'credentials_example' # str | Credentials unique identifier + + try: + # Revoke LTI 1.x credentials + api_instance.revoke_lti_credentials(credentials) + except Exception as e: + print("Exception when calling OrganizationApi->revoke_lti_credentials: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **credentials** | **str**| Credentials unique identifier | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Credentials revoked | - | +**403** | Not admin of an organization | - | +**404** | Credentials not found | - | +**0** | Error | - | + +[[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) + +# **update_lti_configuration** +> LtiConfiguration update_lti_configuration(configuration, lti_configuration_update) + +Update an existing LTI configuration (edit 1.3; 1.1 not editable) + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.lti_configuration import LtiConfiguration +from flat_api.models.lti_configuration_update import LtiConfigurationUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + configuration = 'configuration_example' # str | Configuration unique identifier + lti_configuration_update = flat_api.LtiConfigurationUpdate() # LtiConfigurationUpdate | + + try: + # Update an existing LTI configuration (edit 1.3; 1.1 not editable) + api_response = api_instance.update_lti_configuration(configuration, lti_configuration_update) + print("The response of OrganizationApi->update_lti_configuration:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->update_lti_configuration: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **configuration** | **str**| Configuration unique identifier | + **lti_configuration_update** | [**LtiConfigurationUpdate**](LtiConfigurationUpdate.md)| | + +### Return type + +[**LtiConfiguration**](LtiConfiguration.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The updated configuration | - | +**0** | Error | - | + +[[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) + +# **update_organization_user** +> UserDetailsAdmin update_organization_user(user, body) + +Update account information + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_admin_update import UserAdminUpdate +from flat_api.models.user_details_admin import UserDetailsAdmin +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.OrganizationApi(api_client) + user = 'user_example' # str | Unique identifier of the Flat account + body = flat_api.UserAdminUpdate() # UserAdminUpdate | + + try: + # Update account information + api_response = api_instance.update_organization_user(user, body) + print("The response of OrganizationApi->update_organization_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrganizationApi->update_organization_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| Unique identifier of the Flat account | + **body** | [**UserAdminUpdate**](UserAdminUpdate.md)| | + +### Return type + +[**UserDetailsAdmin**](UserDetailsAdmin.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | User updated | - | +**0** | Error | - | + +[[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/reference/OrganizationInvitation.md b/docs/reference/OrganizationInvitation.md new file mode 100644 index 0000000..82a0ce9 --- /dev/null +++ b/docs/reference/OrganizationInvitation.md @@ -0,0 +1,39 @@ +# OrganizationInvitation + +Details of an invitation to join an organization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The invitation unique identifier | [optional] +**creation_date** | **datetime** | The creation date of the invitation | [optional] +**organization** | **str** | The unique identifier of the Organization this invitation belongs to | +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | +**custom_code** | **str** | Enrollment code to use when joining this organization | +**email** | **str** | The email address this invitation was sent to | [optional] +**invited_by** | **str** | The unique identifier of the User who created this invitation | [optional] +**html_url** | **str** | 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** | **List[str]** | List of users who used this invitation | [optional] + +## Example + +```python +from flat_api.models.organization_invitation import OrganizationInvitation + +# TODO update the JSON string below +json = "{}" +# create an instance of OrganizationInvitation from a JSON string +organization_invitation_instance = OrganizationInvitation.from_json(json) +# print the JSON string representation of the object +print(OrganizationInvitation.to_json()) + +# convert the object into a dict +organization_invitation_dict = organization_invitation_instance.to_dict() +# create an instance of OrganizationInvitation from a dict +organization_invitation_from_dict = OrganizationInvitation.from_dict(organization_invitation_dict) +``` +[[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/OrganizationInvitationCreation.md b/docs/reference/OrganizationInvitationCreation.md new file mode 100644 index 0000000..756cada --- /dev/null +++ b/docs/reference/OrganizationInvitationCreation.md @@ -0,0 +1,31 @@ +# OrganizationInvitationCreation + +The parameters to create an organization invitation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **str** | The email address you want to send the invitation to | [optional] +**organization_role** | **str** | User's Organization Role | [optional] [default to 'teacher'] + +## Example + +```python +from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of OrganizationInvitationCreation from a JSON string +organization_invitation_creation_instance = OrganizationInvitationCreation.from_json(json) +# print the JSON string representation of the object +print(OrganizationInvitationCreation.to_json()) + +# convert the object into a dict +organization_invitation_creation_dict = organization_invitation_creation_instance.to_dict() +# create an instance of OrganizationInvitationCreation from a dict +organization_invitation_creation_from_dict = OrganizationInvitationCreation.from_dict(organization_invitation_creation_dict) +``` +[[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/OrganizationRoles.md b/docs/reference/OrganizationRoles.md new file mode 100644 index 0000000..d21b15a --- /dev/null +++ b/docs/reference/OrganizationRoles.md @@ -0,0 +1,17 @@ +# OrganizationRoles + +User's Organization Role (for Edu users only) + +## Enum + +* `ADMIN` (value: `'admin'`) + +* `ACCOUNTADMIN` (value: `'accountAdmin'`) + +* `TEACHER` (value: `'teacher'`) + +* `USER` (value: `'user'`) + +[[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/OrganizationUserAccessTokenCreation.md b/docs/reference/OrganizationUserAccessTokenCreation.md new file mode 100644 index 0000000..df48fbe --- /dev/null +++ b/docs/reference/OrganizationUserAccessTokenCreation.md @@ -0,0 +1,30 @@ +# OrganizationUserAccessTokenCreation + +Creation of a delegated API access token for an organization user + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scopes** | [**List[AppScopes]**](AppScopes.md) | List of requested scopes for this credential | + +## Example + +```python +from flat_api.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of OrganizationUserAccessTokenCreation from a JSON string +organization_user_access_token_creation_instance = OrganizationUserAccessTokenCreation.from_json(json) +# print the JSON string representation of the object +print(OrganizationUserAccessTokenCreation.to_json()) + +# convert the object into a dict +organization_user_access_token_creation_dict = organization_user_access_token_creation_instance.to_dict() +# create an instance of OrganizationUserAccessTokenCreation from a dict +organization_user_access_token_creation_from_dict = OrganizationUserAccessTokenCreation.from_dict(organization_user_access_token_creation_dict) +``` +[[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/RenameGroupRequest.md b/docs/reference/RenameGroupRequest.md new file mode 100644 index 0000000..b82a4fd --- /dev/null +++ b/docs/reference/RenameGroupRequest.md @@ -0,0 +1,29 @@ +# RenameGroupRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | New name for the group | + +## Example + +```python +from flat_api.models.rename_group_request import RenameGroupRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of RenameGroupRequest from a JSON string +rename_group_request_instance = RenameGroupRequest.from_json(json) +# print the JSON string representation of the object +print(RenameGroupRequest.to_json()) + +# convert the object into a dict +rename_group_request_dict = rename_group_request_instance.to_dict() +# create an instance of RenameGroupRequest from a dict +rename_group_request_from_dict = RenameGroupRequest.from_dict(rename_group_request_dict) +``` +[[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/ResourceCollaborator.md b/docs/reference/ResourceCollaborator.md similarity index 51% rename from docs/ResourceCollaborator.md rename to docs/reference/ResourceCollaborator.md index fea4153..0803524 100644 --- a/docs/ResourceCollaborator.md +++ b/docs/reference/ResourceCollaborator.md @@ -1,18 +1,42 @@ # ResourceCollaborator +A collaborator of a score. The `userEmail` and `group` are only available if the requesting user is a collaborator of the related score (otherwise these permissions are not listed or exposed publicly). + ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**acl_read** | **bool** | `True` if the current user can read the current document | [optional] [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. | [optional] [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. | [optional] [default to False] +**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** | **str** | The type of the collaborator for the resource | [optional] **id** | **str** | The unique identifier of the permission | [optional] +**var_date** | **datetime** | The date when the permission was added | [optional] **score** | **str** | If this object is a permission of a score, this property will contain the unique identifier of the score | [optional] **collection** | **str** | If this object is a permission of a collection, this property will contain the unique identifier of the collection | [optional] **user** | [**UserPublic**](UserPublic.md) | | [optional] **group** | [**Group**](Group.md) | | [optional] -**user_email** | **str** | If the collaborator is not a user of Flat yet, this field will contain his email. | [optional] +**user_email** | **str** | 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] + +## Example + +```python +from flat_api.models.resource_collaborator import ResourceCollaborator + +# TODO update the JSON string below +json = "{}" +# create an instance of ResourceCollaborator from a JSON string +resource_collaborator_instance = ResourceCollaborator.from_json(json) +# print the JSON string representation of the object +print(ResourceCollaborator.to_json()) +# convert the object into a dict +resource_collaborator_dict = resource_collaborator_instance.to_dict() +# create an instance of ResourceCollaborator from a dict +resource_collaborator_from_dict = ResourceCollaborator.from_dict(resource_collaborator_dict) +``` [[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/ResourceCollaboratorCreation.md b/docs/reference/ResourceCollaboratorCreation.md similarity index 52% rename from docs/ResourceCollaboratorCreation.md rename to docs/reference/ResourceCollaboratorCreation.md index 2faa040..07713d7 100644 --- a/docs/ResourceCollaboratorCreation.md +++ b/docs/reference/ResourceCollaboratorCreation.md @@ -1,6 +1,9 @@ # ResourceCollaboratorCreation +Add a collaborator to a resource. + ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **user** | **str** | The unique identifier of a Flat user | [optional] @@ -9,8 +12,25 @@ Name | Type | Description | Notes **user_token** | **str** | 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] +**acl_admin** | **bool** | `True` if the related user can manage the current document, i.e. changing the document permissions and deleting the document | [optional] [default to False] + +## Example + +```python +from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ResourceCollaboratorCreation from a JSON string +resource_collaborator_creation_instance = ResourceCollaboratorCreation.from_json(json) +# print the JSON string representation of the object +print(ResourceCollaboratorCreation.to_json()) +# convert the object into a dict +resource_collaborator_creation_dict = resource_collaborator_creation_instance.to_dict() +# create an instance of ResourceCollaboratorCreation from a dict +resource_collaborator_creation_from_dict = ResourceCollaboratorCreation.from_dict(resource_collaborator_creation_dict) +``` [[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/ResourceRights.md b/docs/reference/ResourceRights.md new file mode 100644 index 0000000..70139a1 --- /dev/null +++ b/docs/reference/ResourceRights.md @@ -0,0 +1,34 @@ +# ResourceRights + +The rights of the current user on a score or collection + +## 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** | **str** | The type of the collaborator for the resource | [optional] + +## Example + +```python +from flat_api.models.resource_rights import ResourceRights + +# TODO update the JSON string below +json = "{}" +# create an instance of ResourceRights from a JSON string +resource_rights_instance = ResourceRights.from_json(json) +# print the JSON string representation of the object +print(ResourceRights.to_json()) + +# convert the object into a dict +resource_rights_dict = resource_rights_instance.to_dict() +# create an instance of ResourceRights from a dict +resource_rights_from_dict = ResourceRights.from_dict(resource_rights_dict) +``` +[[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/ScoreApi.md b/docs/reference/ScoreApi.md new file mode 100644 index 0000000..2839dbe --- /dev/null +++ b/docs/reference/ScoreApi.md @@ -0,0 +1,2588 @@ +# flat_api.ScoreApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_score_collaborator**](ScoreApi.md#add_score_collaborator) | **POST** /scores/{score}/collaborators | Add a new collaborator +[**add_score_track**](ScoreApi.md#add_score_track) | **POST** /scores/{score}/tracks | Add a new video or audio track to the score +[**create_export_task**](ScoreApi.md#create_export_task) | **POST** /scores/{score}/revisions/{revision}/{format}/task | Create a new score export task +[**create_score**](ScoreApi.md#create_score) | **POST** /scores | Create a new score +[**create_score_revision**](ScoreApi.md#create_score_revision) | **POST** /scores/{score}/revisions | Create a new revision +[**delete_score**](ScoreApi.md#delete_score) | **DELETE** /scores/{score} | Delete a score +[**delete_score_comment**](ScoreApi.md#delete_score_comment) | **DELETE** /scores/{score}/comments/{comment} | Delete a comment +[**delete_score_track**](ScoreApi.md#delete_score_track) | **DELETE** /scores/{score}/tracks/{track} | Remove an audio or video track linked to the score +[**edit_score**](ScoreApi.md#edit_score) | **PUT** /scores/{score} | Edit a score's metadata +[**fork_score**](ScoreApi.md#fork_score) | **POST** /scores/{score}/fork | Fork a score +[**get_group_scores**](ScoreApi.md#get_group_scores) | **GET** /groups/{group}/scores | List group's scores +[**get_score**](ScoreApi.md#get_score) | **GET** /scores/{score} | Get a score's metadata +[**get_score_collaborator**](ScoreApi.md#get_score_collaborator) | **GET** /scores/{score}/collaborators/{collaborator} | Get a collaborator +[**get_score_collaborators**](ScoreApi.md#get_score_collaborators) | **GET** /scores/{score}/collaborators | List the collaborators +[**get_score_comments**](ScoreApi.md#get_score_comments) | **GET** /scores/{score}/comments | List comments +[**get_score_revision**](ScoreApi.md#get_score_revision) | **GET** /scores/{score}/revisions/{revision} | Get a score revision +[**get_score_revision_data**](ScoreApi.md#get_score_revision_data) | **GET** /scores/{score}/revisions/{revision}/{format} | Get a score revision data +[**get_score_revisions**](ScoreApi.md#get_score_revisions) | **GET** /scores/{score}/revisions | List the revisions +[**get_score_submissions**](ScoreApi.md#get_score_submissions) | **GET** /scores/{score}/submissions | List submissions related to the score +[**get_score_track**](ScoreApi.md#get_score_track) | **GET** /scores/{score}/tracks/{track} | Retrieve the details of an audio or video track linked to a score +[**get_user_likes**](ScoreApi.md#get_user_likes) | **GET** /users/{user}/likes | List liked scores +[**get_user_scores**](ScoreApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores +[**list_score_tracks**](ScoreApi.md#list_score_tracks) | **GET** /scores/{score}/tracks | List the audio or video tracks linked to a score +[**mark_score_comment_resolved**](ScoreApi.md#mark_score_comment_resolved) | **PUT** /scores/{score}/comments/{comment}/resolved | Mark the comment as resolved +[**mark_score_comment_unresolved**](ScoreApi.md#mark_score_comment_unresolved) | **DELETE** /scores/{score}/comments/{comment}/resolved | Mark the comment as unresolved +[**post_score_comment**](ScoreApi.md#post_score_comment) | **POST** /scores/{score}/comments | Post a new comment +[**remove_score_collaborator**](ScoreApi.md#remove_score_collaborator) | **DELETE** /scores/{score}/collaborators/{collaborator} | Delete a collaborator +[**untrash_score**](ScoreApi.md#untrash_score) | **POST** /scores/{score}/untrash | Untrash a score +[**update_score_comment**](ScoreApi.md#update_score_comment) | **PUT** /scores/{score}/comments/{comment} | Update an existing comment +[**update_score_track**](ScoreApi.md#update_score_track) | **PUT** /scores/{score}/tracks/{track} | Update an audio or video track linked to a score + + +# **add_score_collaborator** +> ResourceCollaborator add_score_collaborator(score, body) + +Add a new collaborator + +Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. +- To add an existing Flat user to the resource, specify their unique identifier in the `user` property. +- To invite an external user to the resource, specify their 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ResourceCollaboratorCreation() # ResourceCollaboratorCreation | + + try: + # Add a new collaborator + api_response = api_instance.add_score_collaborator(score, body) + print("The response of ScoreApi->add_score_collaborator:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->add_score_collaborator: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ResourceCollaboratorCreation**](ResourceCollaboratorCreation.md)| | + +### Return type + +[**ResourceCollaborator**](ResourceCollaborator.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The newly added collaborator metadata | - | +**402** | Account overquota | - | +**403** | Not granted to manage this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **add_score_track** +> ScoreTrackCreationResponse add_score_track(score, body) + +Add a new video or audio track to the score + +Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. +This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_track_creation import ScoreTrackCreation +from flat_api.models.score_track_creation_response import ScoreTrackCreationResponse +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreTrackCreation() # ScoreTrackCreation | + + try: + # Add a new video or audio track to the score + api_response = api_instance.add_score_track(score, body) + print("The response of ScoreApi->add_score_track:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->add_score_track: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreTrackCreation**](ScoreTrackCreation.md)| | + +### Return type + +[**ScoreTrackCreationResponse**](ScoreTrackCreationResponse.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Created track | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **create_export_task** +> Task create_export_task(score, revision, format, sharing_key=sharing_key, body=body) + +Create a new score export task + +Some score exports take longer to process than a single API request allows. +Use this endpoint to launch a new export of one score hosted on Flat. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.task import Task +from flat_api.models.task_export_options import TaskExportOptions +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. + format = 'format_example' # str | 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' # str | This sharing key must be specified to 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_api.TaskExportOptions() # TaskExportOptions | (optional) + + try: + # Create a new score export task + api_response = api_instance.create_export_task(score, revision, format, sharing_key=sharing_key, body=body) + print("The response of ScoreApi->create_export_task:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->create_export_task: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | + **format** | **str**| The format of the file that will be generated or the target service name where the file will be exported | + **sharing_key** | **str**| This sharing key must be specified to 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** | [**TaskExportOptions**](TaskExportOptions.md)| | [optional] + +### Return type + +[**Task**](Task.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Task associated to the generation of the file | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score or associated file not found | - | +**0** | Error | - | + +[[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) + +# **create_score** +> ScoreDetails create_score(body) + +Create a new score + +Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). + +The currently authenticated user will be the 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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_creation import ScoreCreation +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + body = flat_api.ScoreCreation() # ScoreCreation | + + try: + # Create a new score + api_response = api_instance.create_score(body) + print("The response of ScoreApi->create_score:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->create_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ScoreCreation**](ScoreCreation.md)| | + +### Return type + +[**ScoreDetails**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Score created | * x-flat-score-revision -
* x-flat-score-revision-date -
| +**202** | Score will be imported using an asynchronous task (the API client has set `supportsTasks` to true) | - | +**400** | Bad score creation request | - | +**402** | Account overquota or feature not included in plan | - | +**0** | Error | - | + +[[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) + +# **create_score_revision** +> ScoreRevision create_score_revision(score, body) + +Create a new revision + +Update a score by uploading a new revision for this one. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_revision import ScoreRevision +from flat_api.models.score_revision_creation import ScoreRevisionCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreRevisionCreation() # ScoreRevisionCreation | + + try: + # Create a new revision + api_response = api_instance.create_score_revision(score, body) + print("The response of ScoreApi->create_score_revision:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->create_score_revision: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreRevisionCreation**](ScoreRevisionCreation.md)| | + +### Return type + +[**ScoreRevision**](ScoreRevision.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new created revision metadata | - | +**402** | Account overquota | - | +**403** | Not granted to modify this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **delete_score** +> delete_score(score, now=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's collections. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 as soon as possible (optional) (default to False) + + try: + # Delete a score + api_instance.delete_score(score, now=now) + except Exception as e: + print("Exception when calling ScoreApi->delete_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 as soon as possible | [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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The score has been removed | - | +**403** | Not granted to manage this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **delete_score_comment** +> delete_score_comment(score, comment, event_properties=event_properties, sharing_key=sharing_key) + +Delete a comment + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment + event_properties = '{\"context\":\"discover\",\"screenLevel0\":\"home\",\"screenRoute\":\"/discover\"}' # str | Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Delete a comment + api_instance.delete_score_comment(score, comment, event_properties=event_properties, sharing_key=sharing_key) + except Exception as e: + print("Exception when calling ScoreApi->delete_score_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | + **event_properties** | **str**| Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` | [optional] + **sharing_key** | **str**| This sharing key must be specified to 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The comment has been deleted | - | +**403** | Not granted to access to this score or not the original comment creator | - | +**404** | Score or comment not found | - | +**0** | Error | - | + +[[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) + +# **delete_score_track** +> delete_score_track(score, track) + +Remove an audio or video track linked to the score + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track + + try: + # Remove an audio or video track linked to the score + api_instance.delete_score_track(score, track) + except Exception as e: + print("Exception when calling ScoreApi->delete_score_track: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Track removed | - | +**403** | Not granted to access to this score | - | +**404** | Score or Track not found | - | +**0** | Error | - | + +[[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) + +# **edit_score** +> ScoreDetails edit_score(score, body) + +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`). + +When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. +This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.models.score_modification import ScoreModification +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreModification() # ScoreModification | + + try: + # Edit a score's metadata + api_response = api_instance.edit_score(score, body) + print("The response of ScoreApi->edit_score:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->edit_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreModification**](ScoreModification.md)| | + +### Return type + +[**ScoreDetails**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Score details | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **fork_score** +> ScoreDetails fork_score(score, body, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.models.score_fork import ScoreFork +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreFork() # ScoreFork | + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Fork a score + api_response = api_instance.fork_score(score, body, sharing_key=sharing_key) + print("The response of ScoreApi->fork_score:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->fork_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreFork**](ScoreFork.md)| | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ScoreDetails**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Score details | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_group_scores** +> List[ScoreDetails] get_group_scores(group, parent=parent) + +List group's scores + +Get the list of scores shared with a group. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + group = 'group_example' # str | Unique identifier of a Flat group + parent = 'parent_example' # str | Only return the scores forked from the score `parent` (optional) + + try: + # List group's scores + api_response = api_instance.get_group_scores(group, parent=parent) + print("The response of ScoreApi->get_group_scores:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_group_scores: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **group** | **str**| Unique identifier of a Flat group | + **parent** | **str**| Only return the scores forked from the score `parent` | [optional] + +### Return type + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The group's scores | - | +**404** | Not Found - Group not found or user not member of group | - | +**0** | Error | - | + +[[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) + +# **get_score** +> ScoreDetails get_score(score, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) + + try: + # Get a score's metadata + api_response = api_instance.get_score(score, sharing_key=sharing_key) + print("The response of ScoreApi->get_score:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 + +[**ScoreDetails**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Score details | - | +**402** | Account overquota and this document is out of the granted quota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_score_collaborator** +> ResourceCollaborator get_score_collaborator(score, collaborator, sharing_key=sharing_key) + +Get a collaborator + +Get the information about a collaborator (User or Group). + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Get a collaborator + api_response = api_instance.get_score_collaborator(score, collaborator, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_collaborator:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_collaborator: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ResourceCollaborator**](ResourceCollaborator.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Collaborator information | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score or collaborator not found | - | +**0** | Error | - | + +[[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) + +# **get_score_collaborators** +> List[ResourceCollaborator] get_score_collaborators(score, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) + + try: + # List the collaborators + api_response = api_instance.get_score_collaborators(score, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_collaborators:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_collaborators: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 + +[**List[ResourceCollaborator]**](ResourceCollaborator.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of collaborators | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_score_comments** +> List[ScoreComment] get_score_comments(score, type=type, sort=sort, direction=direction, sharing_key=sharing_key) + +List comments + +This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_comment import ScoreComment +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Filter the comments by type (optional) + sort = 'sort_example' # str | Sort (optional) + direction = 'direction_example' # str | Sort direction (optional) + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # List comments + api_response = api_instance.get_score_comments(score, type=type, sort=sort, direction=direction, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_comments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_comments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Filter the comments by type | [optional] + **sort** | **str**| Sort | [optional] + **direction** | **str**| Sort direction | [optional] + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**List[ScoreComment]**](ScoreComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The comments of the score | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_score_revision** +> ScoreRevision get_score_revision(score, revision, sharing_key=sharing_key) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_revision import ScoreRevision +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | 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' # str | This sharing key must be specified to 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) + + try: + # Get a score revision + api_response = api_instance.get_score_revision(score, revision, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_revision:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_revision: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ScoreRevision**](ScoreRevision.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Revision metadata | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_score_revision_data** +> bytes get_score_revision_data(score, revision, format, sharing_key=sharing_key, parts=parts, default_track=default_track, url=url) + +Get a score revision data + +Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML +`mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent +for is approximated or dropped rather than failing the request. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. + format = 'format_example' # str | The format of the file you will retrieve + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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 = 'parts_example' # str | An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". (optional) + 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. (optional) + url = True # bool | Returns a json with the `url` in it instead of redirecting (optional) + + try: + # Get a score revision data + api_response = api_instance.get_score_revision_data(score, revision, format, sharing_key=sharing_key, parts=parts, default_track=default_track, url=url) + print("The response of ScoreApi->get_score_revision_data:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_revision_data: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. | + **format** | **str**| The format of the file you will retrieve | + **sharing_key** | **str**| This sharing key must be specified to 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** | **str**| An optional set of part UUIDs to export. This parameter must be composed of part 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 + +**bytes** + +### 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Revision data | * x-flat-score-revision -
* x-flat-score-revision-date -
| +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score or associated file not found | - | +**0** | Error | - | + +[[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) + +# **get_score_revisions** +> List[ScoreRevision] get_score_revisions(score, sharing_key=sharing_key) + +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 on the plan of the account, this list may be truncated to the most recent revisions. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_revision import ScoreRevision +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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) + + try: + # List the revisions + api_response = api_instance.get_score_revisions(score, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_revisions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_revisions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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 + +[**List[ScoreRevision]**](ScoreRevision.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of revisions | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **get_score_submissions** +> List[AssignmentSubmission] get_score_submissions(score) + +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 who is part of the organization and has at least read access to the document. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: + # List submissions related to the score + api_response = api_instance.get_score_submissions(score) + print("The response of ScoreApi->get_score_submissions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_submissions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 + +[**List[AssignmentSubmission]**](AssignmentSubmission.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of submissions | - | +**0** | Error | - | + +[[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) + +# **get_score_track** +> ScoreTrack get_score_track(score, track, sharing_key=sharing_key) + +Retrieve the details of an audio or video track linked to a score + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_track import ScoreTrack +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Retrieve the details of an audio or video track linked to a score + api_response = api_instance.get_score_track(score, track, sharing_key=sharing_key) + print("The response of ScoreApi->get_score_track:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_score_track: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score audio track | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ScoreTrack**](ScoreTrack.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Track details | - | +**403** | Not granted to access to this score | - | +**404** | Score or Track not found | - | +**0** | Error | - | + +[[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) + +# **get_user_likes** +> List[ScoreDetails] get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids) + +List liked scores + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. + next = 'next_example' # str | 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 = 'previous_example' # str | 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 = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + ids = True # bool | Return only the identifiers of the scores (optional) + + try: + # List liked scores + api_response = api_instance.get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids) + print("The response of ScoreApi->get_user_likes:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_user_likes: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | + **next** | **str**| 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** | **str**| 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 + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of liked scores | - | +**0** | Error | - | + +[[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) + +# **get_user_scores** +> List[ScoreDetails] get_user_scores(user, paginate=paginate, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + +List user's scores + +Get the list of public scores owned by a User. +If you want to access private scores, please use the [Collections API](#tag/Collection). +For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + user = 'user_example' # str | 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. (optional) (default to False) + sort = 'sort_example' # str | Sort (optional) + direction = 'direction_example' # str | Sort direction (optional) + limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List user's scores + api_response = api_instance.get_user_scores(user, paginate=paginate, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + print("The response of ScoreApi->get_user_scores:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->get_user_scores: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| 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** | **str**| Sort | [optional] + **direction** | **str**| Sort direction | [optional] + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] + **next** | **str**| 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** | **str**| 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 + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The user scores | - | +**0** | Error | - | + +[[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) + +# **list_score_tracks** +> List[ScoreTrack] list_score_tracks(score, sharing_key=sharing_key, assignment=assignment, list_auto_track=list_auto_track) + +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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_track import ScoreTrack +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | This sharing key must be specified to 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 = 'assignment_example' # str | Only return the tracks related to this assignment (optional) + list_auto_track = True # bool | If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track (optional) + + try: + # List the audio or video tracks linked to a score + api_response = api_instance.list_score_tracks(score, sharing_key=sharing_key, assignment=assignment, list_auto_track=list_auto_track) + print("The response of ScoreApi->list_score_tracks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->list_score_tracks: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| This sharing key must be specified to 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** | **str**| Only return the tracks related to this assignment | [optional] + **list_auto_track** | **bool**| If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track | [optional] + +### Return type + +[**List[ScoreTrack]**](ScoreTrack.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of tracks | - | +**403** | Not granted to access to this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **mark_score_comment_resolved** +> mark_score_comment_resolved(score, comment, sharing_key=sharing_key) + +Mark the comment as resolved + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Mark the comment as resolved + api_instance.mark_score_comment_resolved(score, comment, sharing_key=sharing_key) + except Exception as e: + print("Exception when calling ScoreApi->mark_score_comment_resolved: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | + **sharing_key** | **str**| This sharing key must be specified to 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The comment has been marked as resolved | - | +**403** | Not granted to mark this comment as resolved | - | +**404** | Score or comment not found | - | +**0** | Error | - | + +[[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) + +# **mark_score_comment_unresolved** +> mark_score_comment_unresolved(score, comment, sharing_key=sharing_key) + +Mark the comment as unresolved + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Mark the comment as unresolved + api_instance.mark_score_comment_unresolved(score, comment, sharing_key=sharing_key) + except Exception as e: + print("Exception when calling ScoreApi->mark_score_comment_unresolved: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | + **sharing_key** | **str**| This sharing key must be specified to 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The comment has been unmarked as resolved | - | +**403** | Not granted to unmark this comment as resolved | - | +**404** | Score or comment not found | - | +**0** | Error | - | + +[[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) + +# **post_score_comment** +> ScoreComment post_score_comment(score, body, sharing_key=sharing_key) + +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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_comment import ScoreComment +from flat_api.models.score_comment_creation import ScoreCommentCreation +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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_api.ScoreCommentCreation() # ScoreCommentCreation | + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Post a new comment + api_response = api_instance.post_score_comment(score, body, sharing_key=sharing_key) + print("The response of ScoreApi->post_score_comment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->post_score_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | [**ScoreCommentCreation**](ScoreCommentCreation.md)| | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ScoreComment**](ScoreComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The new comment | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score, to post a comment, or your API call triggered our spam filter. | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **remove_score_collaborator** +> remove_score_collaborator(score, collaborator, event_properties=event_properties) + +Delete a collaborator + +Remove the specified collaborator from the score + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | 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\"}' # str | Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` (optional) + + try: + # Delete a collaborator + api_instance.remove_score_collaborator(score, collaborator, event_properties=event_properties) + except Exception as e: + print("Exception when calling ScoreApi->remove_score_collaborator: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** | + **event_properties** | **str**| Optional analytics properties merged into the analytics events recorded 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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The collaborator has been removed | - | +**403** | Not granted to manage this score | - | +**404** | Score or collaborator not found | - | +**0** | Error | - | + +[[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) + +# **untrash_score** +> untrash_score(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 + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: + # Untrash a score + api_instance.untrash_score(score) + except Exception as e: + print("Exception when calling ScoreApi->untrash_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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 + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | The score has been untrashed | - | +**403** | Not granted to manage this score | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **update_score_comment** +> ScoreComment update_score_comment(score, comment, body, sharing_key=sharing_key) + +Update an existing comment + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_comment import ScoreComment +from flat_api.models.score_comment_update import ScoreCommentUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a sheet music comment + body = flat_api.ScoreCommentUpdate() # ScoreCommentUpdate | + sharing_key = 'sharing_key_example' # str | This sharing key must be specified to 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) + + try: + # Update an existing comment + api_response = api_instance.update_score_comment(score, comment, body, sharing_key=sharing_key) + print("The response of ScoreApi->update_score_comment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->update_score_comment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a sheet music comment | + **body** | [**ScoreCommentUpdate**](ScoreCommentUpdate.md)| | + **sharing_key** | **str**| This sharing key must be specified to 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 + +[**ScoreComment**](ScoreComment.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The edited comment | - | +**402** | Account overquota | - | +**403** | Not granted to access to this score or not the original comment creator | - | +**404** | Score not found | - | +**0** | Error | - | + +[[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) + +# **update_score_track** +> ScoreTrack update_score_track(score, track, body) + +Update an audio or video track linked to a score + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_track import ScoreTrack +from flat_api.models.score_track_update import ScoreTrackUpdate +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.ScoreApi(api_client) + score = 'score_example' # str | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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' # str | Unique identifier of a score audio track + body = flat_api.ScoreTrackUpdate() # ScoreTrackUpdate | + + try: + # Update an audio or video track linked to a score + api_response = api_instance.update_score_track(score, track, body) + print("The response of ScoreApi->update_score_track:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ScoreApi->update_score_track: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **score** | **str**| Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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** | **str**| Unique identifier of a score audio track | + **body** | [**ScoreTrackUpdate**](ScoreTrackUpdate.md)| | + +### Return type + +[**ScoreTrack**](ScoreTrack.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Updated track | - | +**403** | Not granted to access to this score | - | +**404** | Score or Track not found | - | +**0** | Error | - | + +[[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/reference/ScoreComment.md b/docs/reference/ScoreComment.md new file mode 100644 index 0000000..02832cb --- /dev/null +++ b/docs/reference/ScoreComment.md @@ -0,0 +1,45 @@ +# ScoreComment + +Comment added on a sheet music + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The comment unique identifier | +**type** | **str** | The type of the comment | +**user** | **str** | The author unique identifier | +**score** | **str** | The unique identifier of the score where the comment was posted | +**revision** | **str** | The unique identifier of the revision where the comment was posted | [optional] +**reply_to** | **str** | When the comment is a reply to another comment, the unique identifier of the parent comment | [optional] +**var_date** | **datetime** | The date when the comment was posted | +**modification_date** | **datetime** | The date of the last comment modification | [optional] +**comment** | **str** | The comment text that can include mentions using the following format: `@[id:username]`. | +**raw_comment** | **str** | A raw version of the comment, that can be displayed without parsing the mentions. | +**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [optional] +**mentions** | **List[str]** | The list of user identifiers mentioned in this comment | [optional] +**resolved** | **bool** | For inline comments, the comment can be marked as resolved and will be hidden in the future responses | [optional] +**resolved_by** | **str** | If the comment is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved | [optional] +**moderation** | [**ScoreCommentModeration**](ScoreCommentModeration.md) | | [optional] +**spam** | **bool** | `true` if the message has been detected as spam and hidden from other users | [optional] + +## Example + +```python +from flat_api.models.score_comment import ScoreComment + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreComment from a JSON string +score_comment_instance = ScoreComment.from_json(json) +# print the JSON string representation of the object +print(ScoreComment.to_json()) + +# convert the object into a dict +score_comment_dict = score_comment_instance.to_dict() +# create an instance of ScoreComment from a dict +score_comment_from_dict = ScoreComment.from_dict(score_comment_dict) +``` +[[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/ScoreCommentContext.md b/docs/reference/ScoreCommentContext.md new file mode 100644 index 0000000..22c2959 --- /dev/null +++ b/docs/reference/ScoreCommentContext.md @@ -0,0 +1,37 @@ +# ScoreCommentContext + +The context of the comment (for inline/contextualized comments). A context will include all the information related to the location of the comment (i.e. score parts, range of measure, time position). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**part_uuid** | **str** | The unique identifier (UUID) of the score part | +**staff_idx** | **float** | (Deprecated, use `staffUuid`) The identifier of the staff | [optional] +**staff_uuid** | **str** | The unique identifier (UUID) of the staff | [optional] +**measure_uuids** | **List[str]** | The list of measure UUIDs | +**start_time_pos** | **float** | | +**stop_time_pos** | **float** | | +**start_dpq** | **float** | | +**stop_dpq** | **float** | | + +## Example + +```python +from flat_api.models.score_comment_context import ScoreCommentContext + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCommentContext from a JSON string +score_comment_context_instance = ScoreCommentContext.from_json(json) +# print the JSON string representation of the object +print(ScoreCommentContext.to_json()) + +# convert the object into a dict +score_comment_context_dict = score_comment_context_instance.to_dict() +# create an instance of ScoreCommentContext from a dict +score_comment_context_from_dict = ScoreCommentContext.from_dict(score_comment_context_dict) +``` +[[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/ScoreCommentCreation.md b/docs/reference/ScoreCommentCreation.md new file mode 100644 index 0000000..9f32b4a --- /dev/null +++ b/docs/reference/ScoreCommentCreation.md @@ -0,0 +1,35 @@ +# ScoreCommentCreation + +Creation of a comment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**revision** | **str** | 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** | **str** | The comment text that can include mentions using the following format: `@[id:username]`. | +**raw_comment** | **str** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] +**mentions** | **List[str]** | The list of user identifiers mentioned in this comment | [optional] +**reply_to** | **str** | When the comment is a reply to another comment, the unique identifier of the parent comment | [optional] +**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [optional] + +## Example + +```python +from flat_api.models.score_comment_creation import ScoreCommentCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCommentCreation from a JSON string +score_comment_creation_instance = ScoreCommentCreation.from_json(json) +# print the JSON string representation of the object +print(ScoreCommentCreation.to_json()) + +# convert the object into a dict +score_comment_creation_dict = score_comment_creation_instance.to_dict() +# create an instance of ScoreCommentCreation from a dict +score_comment_creation_from_dict = ScoreCommentCreation.from_dict(score_comment_creation_dict) +``` +[[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/ScoreCommentModeration.md b/docs/reference/ScoreCommentModeration.md new file mode 100644 index 0000000..576be45 --- /dev/null +++ b/docs/reference/ScoreCommentModeration.md @@ -0,0 +1,31 @@ +# ScoreCommentModeration + +Information about the comment being moderated + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hidden** | **bool** | If true, this comment will be hidden from other users | [optional] +**reason** | **str** | If the comment is hidden, the reason why this one has been moderated | [optional] + +## Example + +```python +from flat_api.models.score_comment_moderation import ScoreCommentModeration + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCommentModeration from a JSON string +score_comment_moderation_instance = ScoreCommentModeration.from_json(json) +# print the JSON string representation of the object +print(ScoreCommentModeration.to_json()) + +# convert the object into a dict +score_comment_moderation_dict = score_comment_moderation_instance.to_dict() +# create an instance of ScoreCommentModeration from a dict +score_comment_moderation_from_dict = ScoreCommentModeration.from_dict(score_comment_moderation_dict) +``` +[[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/ScoreCommentUpdate.md b/docs/reference/ScoreCommentUpdate.md new file mode 100644 index 0000000..dc72b1d --- /dev/null +++ b/docs/reference/ScoreCommentUpdate.md @@ -0,0 +1,33 @@ +# ScoreCommentUpdate + +Update of a comment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**revision** | **str** | 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** | **str** | The comment text that can include mentions using the following format: `@[id:username]`. | [optional] +**raw_comment** | **str** | A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. | [optional] +**context** | [**ScoreCommentContext**](ScoreCommentContext.md) | | [optional] + +## Example + +```python +from flat_api.models.score_comment_update import ScoreCommentUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCommentUpdate from a JSON string +score_comment_update_instance = ScoreCommentUpdate.from_json(json) +# print the JSON string representation of the object +print(ScoreCommentUpdate.to_json()) + +# convert the object into a dict +score_comment_update_dict = score_comment_update_instance.to_dict() +# create an instance of ScoreCommentUpdate from a dict +score_comment_update_from_dict = ScoreCommentUpdate.from_dict(score_comment_update_dict) +``` +[[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/ScoreCommentsCounts.md b/docs/reference/ScoreCommentsCounts.md new file mode 100644 index 0000000..66a055b --- /dev/null +++ b/docs/reference/ScoreCommentsCounts.md @@ -0,0 +1,34 @@ +# ScoreCommentsCounts + +A computed version of the total, unique, weekly, monthly and yearly number of comments added on the documents (this doesn't include inline comments). + +## 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] + +## Example + +```python +from flat_api.models.score_comments_counts import ScoreCommentsCounts + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCommentsCounts from a JSON string +score_comments_counts_instance = ScoreCommentsCounts.from_json(json) +# print the JSON string representation of the object +print(ScoreCommentsCounts.to_json()) + +# convert the object into a dict +score_comments_counts_dict = score_comments_counts_instance.to_dict() +# create an instance of ScoreCommentsCounts from a dict +score_comments_counts_from_dict = ScoreCommentsCounts.from_dict(score_comments_counts_dict) +``` +[[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/ScoreCreation.md b/docs/reference/ScoreCreation.md new file mode 100644 index 0000000..5b455cf --- /dev/null +++ b/docs/reference/ScoreCreation.md @@ -0,0 +1,38 @@ +# ScoreCreation + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**collection** | **str** | 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** | **str** | If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. | [optional] +**builder_data** | [**ScoreCreationBuilderDataAllOfBuilderData**](ScoreCreationBuilderDataAllOfBuilderData.md) | | +**filename** | **str** | If this is an imported file, its filename | [optional] +**data** | **str** | 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** | **str** | 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] +**source** | [**ScoreSource**](ScoreSource.md) | | + +## Example + +```python +from flat_api.models.score_creation import ScoreCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreation from a JSON string +score_creation_instance = ScoreCreation.from_json(json) +# print the JSON string representation of the object +print(ScoreCreation.to_json()) + +# convert the object into a dict +score_creation_dict = score_creation_instance.to_dict() +# create an instance of ScoreCreation from a dict +score_creation_from_dict = ScoreCreation.from_dict(score_creation_dict) +``` +[[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/ScoreCreationBuilderData.md b/docs/reference/ScoreCreationBuilderData.md new file mode 100644 index 0000000..7feb051 --- /dev/null +++ b/docs/reference/ScoreCreationBuilderData.md @@ -0,0 +1,33 @@ +# ScoreCreationBuilderData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**collection** | **str** | 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** | **str** | If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. | [optional] +**builder_data** | [**ScoreCreationBuilderDataAllOfBuilderData**](ScoreCreationBuilderDataAllOfBuilderData.md) | | + +## Example + +```python +from flat_api.models.score_creation_builder_data import ScoreCreationBuilderData + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationBuilderData from a JSON string +score_creation_builder_data_instance = ScoreCreationBuilderData.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationBuilderData.to_json()) + +# convert the object into a dict +score_creation_builder_data_dict = score_creation_builder_data_instance.to_dict() +# create an instance of ScoreCreationBuilderData from a dict +score_creation_builder_data_from_dict = ScoreCreationBuilderData.from_dict(score_creation_builder_data_dict) +``` +[[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/ScoreCreationBuilderDataAllOfBuilderData.md b/docs/reference/ScoreCreationBuilderDataAllOfBuilderData.md new file mode 100644 index 0000000..1cb972f --- /dev/null +++ b/docs/reference/ScoreCreationBuilderDataAllOfBuilderData.md @@ -0,0 +1,30 @@ +# ScoreCreationBuilderDataAllOfBuilderData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**score_data** | [**ScoreCreationBuilderDataAllOfBuilderDataScoreData**](ScoreCreationBuilderDataAllOfBuilderDataScoreData.md) | | +**layout_data** | [**ScoreCreationBuilderDataAllOfBuilderDataLayoutData**](ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md) | | [optional] + +## Example + +```python +from flat_api.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationBuilderDataAllOfBuilderData from a JSON string +score_creation_builder_data_all_of_builder_data_instance = ScoreCreationBuilderDataAllOfBuilderData.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationBuilderDataAllOfBuilderData.to_json()) + +# convert the object into a dict +score_creation_builder_data_all_of_builder_data_dict = score_creation_builder_data_all_of_builder_data_instance.to_dict() +# create an instance of ScoreCreationBuilderDataAllOfBuilderData from a dict +score_creation_builder_data_all_of_builder_data_from_dict = ScoreCreationBuilderDataAllOfBuilderData.from_dict(score_creation_builder_data_all_of_builder_data_dict) +``` +[[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/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md new file mode 100644 index 0000000..3f575bb --- /dev/null +++ b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataLayoutData.md @@ -0,0 +1,37 @@ +# ScoreCreationBuilderDataAllOfBuilderDataLayoutData + +Control the appearance of the score. If missing, default values are used. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**notes_spacing_coeff** | **float** | A float value >= 1 that controls the spacing between notes. | [optional] +**length_unit** | **str** | 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] + +## Example + +```python +from flat_api.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a JSON string +score_creation_builder_data_all_of_builder_data_layout_data_instance = ScoreCreationBuilderDataAllOfBuilderDataLayoutData.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationBuilderDataAllOfBuilderDataLayoutData.to_json()) + +# convert the object into a dict +score_creation_builder_data_all_of_builder_data_layout_data_dict = score_creation_builder_data_all_of_builder_data_layout_data_instance.to_dict() +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a dict +score_creation_builder_data_all_of_builder_data_layout_data_from_dict = ScoreCreationBuilderDataAllOfBuilderDataLayoutData.from_dict(score_creation_builder_data_all_of_builder_data_layout_data_dict) +``` +[[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/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md new file mode 100644 index 0000000..0860166 --- /dev/null +++ b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataScoreData.md @@ -0,0 +1,34 @@ +# 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** | [**List[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). | + +## Example + +```python +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a JSON string +score_creation_builder_data_all_of_builder_data_score_data_instance = ScoreCreationBuilderDataAllOfBuilderDataScoreData.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationBuilderDataAllOfBuilderDataScoreData.to_json()) + +# convert the object into a dict +score_creation_builder_data_all_of_builder_data_score_data_dict = score_creation_builder_data_all_of_builder_data_score_data_instance.to_dict() +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a dict +score_creation_builder_data_all_of_builder_data_score_data_from_dict = ScoreCreationBuilderDataAllOfBuilderDataScoreData.from_dict(score_creation_builder_data_all_of_builder_data_score_data_dict) +``` +[[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/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md new file mode 100644 index 0000000..02b663a --- /dev/null +++ b/docs/reference/ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.md @@ -0,0 +1,33 @@ +# ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**group** | **str** | The identifier of the instrument group (e.g. `keyboards`, `brass`) | +**instrument** | **str** | The identifier of the instrument (e.g. `piano`, `trumpet`) | +**long_name** | **str** | The full name of the instrument | [optional] +**short_name** | **str** | The abbreviation of the name of the instrument | [optional] +**has_quarter_tone** | **bool** | True if the part can use quarter tones (prevents the part from having a TAB staff or chord grid) | [optional] + +## Example + +```python +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a JSON string +score_creation_builder_data_all_of_builder_data_score_data_instruments_instance = ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.to_json()) + +# convert the object into a dict +score_creation_builder_data_all_of_builder_data_score_data_instruments_dict = score_creation_builder_data_all_of_builder_data_score_data_instruments_instance.to_dict() +# create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a dict +score_creation_builder_data_all_of_builder_data_score_data_instruments_from_dict = ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.from_dict(score_creation_builder_data_all_of_builder_data_score_data_instruments_dict) +``` +[[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/ScoreCreationCommon.md b/docs/reference/ScoreCreationCommon.md new file mode 100644 index 0000000..956922d --- /dev/null +++ b/docs/reference/ScoreCreationCommon.md @@ -0,0 +1,32 @@ +# ScoreCreationCommon + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**collection** | **str** | 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** | **str** | If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. | [optional] + +## Example + +```python +from flat_api.models.score_creation_common import ScoreCreationCommon + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationCommon from a JSON string +score_creation_common_instance = ScoreCreationCommon.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationCommon.to_json()) + +# convert the object into a dict +score_creation_common_dict = score_creation_common_instance.to_dict() +# create an instance of ScoreCreationCommon from a dict +score_creation_common_from_dict = ScoreCreationCommon.from_dict(score_creation_common_dict) +``` +[[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/ScoreCreationFileImport.md b/docs/reference/ScoreCreationFileImport.md new file mode 100644 index 0000000..3bf798e --- /dev/null +++ b/docs/reference/ScoreCreationFileImport.md @@ -0,0 +1,36 @@ +# ScoreCreationFileImport + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**collection** | **str** | 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** | **str** | If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. | [optional] +**filename** | **str** | If this is an imported file, its filename | [optional] +**data** | **str** | 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** | **str** | 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] + +## Example + +```python +from flat_api.models.score_creation_file_import import ScoreCreationFileImport + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationFileImport from a JSON string +score_creation_file_import_instance = ScoreCreationFileImport.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationFileImport.to_json()) + +# convert the object into a dict +score_creation_file_import_dict = score_creation_file_import_instance.to_dict() +# create an instance of ScoreCreationFileImport from a dict +score_creation_file_import_from_dict = ScoreCreationFileImport.from_dict(score_creation_file_import_dict) +``` +[[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/ScoreCreationGoogleDriveImport.md b/docs/reference/ScoreCreationGoogleDriveImport.md new file mode 100644 index 0000000..3bc64ae --- /dev/null +++ b/docs/reference/ScoreCreationGoogleDriveImport.md @@ -0,0 +1,33 @@ +# ScoreCreationGoogleDriveImport + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | 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** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**collection** | **str** | 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** | **str** | If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. | [optional] +**source** | [**ScoreSource**](ScoreSource.md) | | + +## Example + +```python +from flat_api.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreCreationGoogleDriveImport from a JSON string +score_creation_google_drive_import_instance = ScoreCreationGoogleDriveImport.from_json(json) +# print the JSON string representation of the object +print(ScoreCreationGoogleDriveImport.to_json()) + +# convert the object into a dict +score_creation_google_drive_import_dict = score_creation_google_drive_import_instance.to_dict() +# create an instance of ScoreCreationGoogleDriveImport from a dict +score_creation_google_drive_import_from_dict = ScoreCreationGoogleDriveImport.from_dict(score_creation_google_drive_import_dict) +``` +[[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/ScoreCreationType.md b/docs/reference/ScoreCreationType.md similarity index 52% rename from docs/ScoreCreationType.md rename to docs/reference/ScoreCreationType.md index d2e2aa7..1bf8923 100644 --- a/docs/ScoreCreationType.md +++ b/docs/reference/ScoreCreationType.md @@ -1,8 +1,14 @@ # ScoreCreationType -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +The type of creation (an original, an arrangement) + +## Enum + +* `ORIGINAL` (value: `'original'`) + +* `ARRANGEMENT` (value: `'arrangement'`) + +* `OTHER` (value: `'other'`) [[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/ScoreDetails.md b/docs/reference/ScoreDetails.md new file mode 100644 index 0000000..ad68348 --- /dev/null +++ b/docs/reference/ScoreDetails.md @@ -0,0 +1,68 @@ +# ScoreDetails + +The score and all its details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the score | +**sharing_key** | **str** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] +**title** | **str** | The title of the score | +**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [default to ScorePrivacy.PRIVATE] +**user** | [**UserPublic**](UserPublic.md) | | +**html_url** | **str** | The url where the score can be viewed in a web browser | +**edit_html_url** | **str** | The url where the score can be edited in a web browser | +**subtitle** | **str** | Subtitle of the score | [optional] +**lyricist** | **str** | Lyricist of the score | [optional] +**arranger** | **str** | Arranger of the score | [optional] +**composer** | **str** | Composer of the score | [optional] +**description** | **str** | Description of the creation | [optional] +**tags** | **List[str]** | Tags describing the score | [optional] +**creation_type** | [**ScoreCreationType**](ScoreCreationType.md) | | [optional] +**license** | [**ScoreLicense**](ScoreLicense.md) | | [optional] +**license_text** | **str** | Additional license text written on the exported/printed score | [optional] +**duration_time** | **float** | In seconds, an approximate 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** | [**ResourceRights**](ResourceRights.md) | | [optional] +**collaborators** | [**List[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, and 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** | **str** | 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** | **str** | If the score has been forked, the unique identifier of the parent score. | [optional] +**instruments** | **List[str]** | 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 Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. | +**instruments_names** | **List[str]** | 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** | **List[str]** | An array of the audio sample identifiers used by the different score parts. The format of the strings is `{instrument-group}.{sample-id}`. | +**google_drive_file_id** | **str** | 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** | [**ScoreLikesCounts**](ScoreLikesCounts.md) | | [optional] +**comments** | [**ScoreCommentsCounts**](ScoreCommentsCounts.md) | | [optional] +**views** | [**ScoreViewsCounts**](ScoreViewsCounts.md) | | [optional] +**plays** | [**ScorePlaysCounts**](ScorePlaysCounts.md) | | [optional] +**collections** | **List[str]** | The list of parent collections this score is included in. Please note that you might not have access to all of them. | [optional] +**me** | [**ScoreDetailsAllOfMe**](ScoreDetailsAllOfMe.md) | | [optional] + +## Example + +```python +from flat_api.models.score_details import ScoreDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreDetails from a JSON string +score_details_instance = ScoreDetails.from_json(json) +# print the JSON string representation of the object +print(ScoreDetails.to_json()) + +# convert the object into a dict +score_details_dict = score_details_instance.to_dict() +# create an instance of ScoreDetails from a dict +score_details_from_dict = ScoreDetails.from_dict(score_details_dict) +``` +[[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/ScoreDetailsAllOfMe.md b/docs/reference/ScoreDetailsAllOfMe.md new file mode 100644 index 0000000..c117d10 --- /dev/null +++ b/docs/reference/ScoreDetailsAllOfMe.md @@ -0,0 +1,31 @@ +# ScoreDetailsAllOfMe + +Information about the authenticated user and this score + +## 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 | + +## Example + +```python +from flat_api.models.score_details_all_of_me import ScoreDetailsAllOfMe + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreDetailsAllOfMe from a JSON string +score_details_all_of_me_instance = ScoreDetailsAllOfMe.from_json(json) +# print the JSON string representation of the object +print(ScoreDetailsAllOfMe.to_json()) + +# convert the object into a dict +score_details_all_of_me_dict = score_details_all_of_me_instance.to_dict() +# create an instance of ScoreDetailsAllOfMe from a dict +score_details_all_of_me_from_dict = ScoreDetailsAllOfMe.from_dict(score_details_all_of_me_dict) +``` +[[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/ScoreFork.md b/docs/reference/ScoreFork.md new file mode 100644 index 0000000..05fa80e --- /dev/null +++ b/docs/reference/ScoreFork.md @@ -0,0 +1,32 @@ +# ScoreFork + +Options to fork the score + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collection** | **str** | 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] + +## Example + +```python +from flat_api.models.score_fork import ScoreFork + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreFork from a JSON string +score_fork_instance = ScoreFork.from_json(json) +# print the JSON string representation of the object +print(ScoreFork.to_json()) + +# convert the object into a dict +score_fork_dict = score_fork_instance.to_dict() +# create an instance of ScoreFork from a dict +score_fork_from_dict = ScoreFork.from_dict(score_fork_dict) +``` +[[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/ScoreLicense.md b/docs/reference/ScoreLicense.md new file mode 100644 index 0000000..c13bd48 --- /dev/null +++ b/docs/reference/ScoreLicense.md @@ -0,0 +1,25 @@ +# ScoreLicense + +License of the creation. Read more about the Creative Commons licenses on https://creativecommons.org/licenses/ + +## Enum + +* `COPYRIGHT` (value: `'copyright'`) + +* `CC0` (value: `'cc0'`) + +* `CC_MINUS_BY` (value: `'cc-by'`) + +* `CC_MINUS_BY_MINUS_SA` (value: `'cc-by-sa'`) + +* `CC_MINUS_BY_MINUS_ND` (value: `'cc-by-nd'`) + +* `CC_MINUS_BY_MINUS_NC` (value: `'cc-by-nc'`) + +* `CC_MINUS_BY_MINUS_NC_MINUS_SA` (value: `'cc-by-nc-sa'`) + +* `CC_MINUS_BY_MINUS_NC_MINUS_ND` (value: `'cc-by-nc-nd'`) + +[[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/ScoreLikesCounts.md b/docs/reference/ScoreLikesCounts.md new file mode 100644 index 0000000..c017f28 --- /dev/null +++ b/docs/reference/ScoreLikesCounts.md @@ -0,0 +1,33 @@ +# ScoreLikesCounts + +A computed version of the weekly, monthly, yearly and total number of likes for a score + +## 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] + +## Example + +```python +from flat_api.models.score_likes_counts import ScoreLikesCounts + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreLikesCounts from a JSON string +score_likes_counts_instance = ScoreLikesCounts.from_json(json) +# print the JSON string representation of the object +print(ScoreLikesCounts.to_json()) + +# convert the object into a dict +score_likes_counts_dict = score_likes_counts_instance.to_dict() +# create an instance of ScoreLikesCounts from a dict +score_likes_counts_from_dict = ScoreLikesCounts.from_dict(score_likes_counts_dict) +``` +[[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/ScoreModification.md b/docs/reference/ScoreModification.md new file mode 100644 index 0000000..8ec3448 --- /dev/null +++ b/docs/reference/ScoreModification.md @@ -0,0 +1,41 @@ +# ScoreModification + +Edit the score metadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | The title of the score | [optional] +**subtitle** | **str** | The subtitle of the score | [optional] +**composer** | **str** | The composer of the score | [optional] +**lyricist** | **str** | The lyricist of the score | [optional] +**arranger** | **str** | The arranger of the score | [optional] +**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [optional] [default to ScorePrivacy.PRIVATE] +**sharing_key** | **str** | 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** | **str** | Description of the creation | [optional] +**tags** | **List[str]** | Tags describing the score | [optional] +**creation_type** | [**ScoreCreationType**](ScoreCreationType.md) | | [optional] +**license** | [**ScoreLicense**](ScoreLicense.md) | | [optional] +**license_text** | **str** | The rights info written on the score | [optional] + +## Example + +```python +from flat_api.models.score_modification import ScoreModification + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreModification from a JSON string +score_modification_instance = ScoreModification.from_json(json) +# print the JSON string representation of the object +print(ScoreModification.to_json()) + +# convert the object into a dict +score_modification_dict = score_modification_instance.to_dict() +# create an instance of ScoreModification from a dict +score_modification_from_dict = ScoreModification.from_dict(score_modification_dict) +``` +[[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/ScorePlaysCounts.md b/docs/reference/ScorePlaysCounts.md new file mode 100644 index 0000000..1b064fa --- /dev/null +++ b/docs/reference/ScorePlaysCounts.md @@ -0,0 +1,33 @@ +# ScorePlaysCounts + +A computed version of the total, weekly, monthly, and yearly number of plays of the score + +## 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] + +## Example + +```python +from flat_api.models.score_plays_counts import ScorePlaysCounts + +# TODO update the JSON string below +json = "{}" +# create an instance of ScorePlaysCounts from a JSON string +score_plays_counts_instance = ScorePlaysCounts.from_json(json) +# print the JSON string representation of the object +print(ScorePlaysCounts.to_json()) + +# convert the object into a dict +score_plays_counts_dict = score_plays_counts_instance.to_dict() +# create an instance of ScorePlaysCounts from a dict +score_plays_counts_from_dict = ScorePlaysCounts.from_dict(score_plays_counts_dict) +``` +[[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/ScorePrivacy.md b/docs/reference/ScorePrivacy.md new file mode 100644 index 0000000..2bab43d --- /dev/null +++ b/docs/reference/ScorePrivacy.md @@ -0,0 +1,17 @@ +# ScorePrivacy + +The score main privacy mode. - `public`: The score is public on the Internet. This one can be accessible at the url `https://flat.io/score/{score}` and can be modified and administered by specified collaborators users. - `private`: The score is private and can be only accessed, modified and administered by specified collaborators users. - `privateLink`: The score is private but can be accessed using a private link `htmlUrl` or the private key in the property `sharingKey`. - `organizationPublic`: _Available only with [Flat for Education](https://flat.io/edu)._ The score is public in the organization: users of the same organization can access it. The score can be modified and administered by specified collaborators users. The score can also be individually shared to a set of users or groups using the different collaborators API methods. When a file is synchronized from an external source (e.g. Google Drive) and the sharing options are changed on the source, Flat will choose the best privacy mode for the file. When using a [Flat for Education](https://flat.io/edu) account, some of the modes may not be available if disabled by an administrator of the organization (e.g. by default the `public` mode is not available). + +## Enum + +* `PUBLIC` (value: `'public'`) + +* `PRIVATE` (value: `'private'`) + +* `ORGANIZATIONPUBLIC` (value: `'organizationPublic'`) + +* `PRIVATELINK` (value: `'privateLink'`) + +[[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/ScoreRevision.md b/docs/reference/ScoreRevision.md new file mode 100644 index 0000000..dc513b2 --- /dev/null +++ b/docs/reference/ScoreRevision.md @@ -0,0 +1,38 @@ +# ScoreRevision + +A score revision metadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the revision. | +**user** | **str** | The user identifier who created the revision | [optional] +**score** | **str** | The score identifier | +**collaborators** | **List[str]** | | [optional] +**var_date** | **datetime** | The date when this revision was created | +**event** | **str** | The last event (action id) of the revision | [optional] +**description** | **str** | 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** | [**ScoreRevisionStatistics**](ScoreRevisionStatistics.md) | | [optional] + +## Example + +```python +from flat_api.models.score_revision import ScoreRevision + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreRevision from a JSON string +score_revision_instance = ScoreRevision.from_json(json) +# print the JSON string representation of the object +print(ScoreRevision.to_json()) + +# convert the object into a dict +score_revision_dict = score_revision_instance.to_dict() +# create an instance of ScoreRevision from a dict +score_revision_from_dict = ScoreRevision.from_dict(score_revision_dict) +``` +[[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/ScoreRevisionCreation.md b/docs/reference/ScoreRevisionCreation.md new file mode 100644 index 0000000..1cc5976 --- /dev/null +++ b/docs/reference/ScoreRevisionCreation.md @@ -0,0 +1,33 @@ +# ScoreRevisionCreation + +A new created revision + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **str** | 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 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** | **str** | 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** | **str** | A description associated to the revision | [optional] + +## Example + +```python +from flat_api.models.score_revision_creation import ScoreRevisionCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreRevisionCreation from a JSON string +score_revision_creation_instance = ScoreRevisionCreation.from_json(json) +# print the JSON string representation of the object +print(ScoreRevisionCreation.to_json()) + +# convert the object into a dict +score_revision_creation_dict = score_revision_creation_instance.to_dict() +# create an instance of ScoreRevisionCreation from a dict +score_revision_creation_from_dict = ScoreRevisionCreation.from_dict(score_revision_creation_dict) +``` +[[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/ScoreRevisionStatistics.md b/docs/reference/ScoreRevisionStatistics.md new file mode 100644 index 0000000..fb3c122 --- /dev/null +++ b/docs/reference/ScoreRevisionStatistics.md @@ -0,0 +1,33 @@ +# ScoreRevisionStatistics + +The statistics related to the score revision (additions and deletions) + +## 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] + +## Example + +```python +from flat_api.models.score_revision_statistics import ScoreRevisionStatistics + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreRevisionStatistics from a JSON string +score_revision_statistics_instance = ScoreRevisionStatistics.from_json(json) +# print the JSON string representation of the object +print(ScoreRevisionStatistics.to_json()) + +# convert the object into a dict +score_revision_statistics_dict = score_revision_statistics_instance.to_dict() +# create an instance of ScoreRevisionStatistics from a dict +score_revision_statistics_from_dict = ScoreRevisionStatistics.from_dict(score_revision_statistics_dict) +``` +[[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/ScoreSource.md b/docs/reference/ScoreSource.md new file mode 100644 index 0000000..d739277 --- /dev/null +++ b/docs/reference/ScoreSource.md @@ -0,0 +1,29 @@ +# ScoreSource + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**google_drive** | **str** | If the score is a file on Google Drive, this 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] + +## Example + +```python +from flat_api.models.score_source import ScoreSource + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreSource from a JSON string +score_source_instance = ScoreSource.from_json(json) +# print the JSON string representation of the object +print(ScoreSource.to_json()) + +# convert the object into a dict +score_source_dict = score_source_instance.to_dict() +# create an instance of ScoreSource from a dict +score_source_from_dict = ScoreSource.from_dict(score_source_dict) +``` +[[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/ScoreSummary.md b/docs/reference/ScoreSummary.md new file mode 100644 index 0000000..b10aa84 --- /dev/null +++ b/docs/reference/ScoreSummary.md @@ -0,0 +1,35 @@ +# ScoreSummary + +A summary of the score details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the score | +**sharing_key** | **str** | The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) | [optional] +**title** | **str** | The title of the score | +**privacy** | [**ScorePrivacy**](ScorePrivacy.md) | | [default to ScorePrivacy.PRIVATE] +**user** | [**UserPublic**](UserPublic.md) | | +**html_url** | **str** | The url where the score can be viewed in a web browser | + +## Example + +```python +from flat_api.models.score_summary import ScoreSummary + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreSummary from a JSON string +score_summary_instance = ScoreSummary.from_json(json) +# print the JSON string representation of the object +print(ScoreSummary.to_json()) + +# convert the object into a dict +score_summary_dict = score_summary_instance.to_dict() +# create an instance of ScoreSummary from a dict +score_summary_from_dict = ScoreSummary.from_dict(score_summary_dict) +``` +[[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/ScoreTrack.md b/docs/reference/ScoreTrack.md new file mode 100644 index 0000000..53ad324 --- /dev/null +++ b/docs/reference/ScoreTrack.md @@ -0,0 +1,42 @@ +# ScoreTrack + +An audio track for a score + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier of the score track | +**title** | **str** | Title of the track | [optional] +**score** | **str** | The unique identifier of the score. Absent for Free Record performance submissions, which are recorded without an attached score. | [optional] +**creator** | **str** | 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** | [**ScoreTrackState**](ScoreTrackState.md) | | [default to ScoreTrackState.DRAFT] +**type** | [**ScoreTrackType**](ScoreTrackType.md) | | +**purpose** | [**ScoreTrackPurpose**](ScoreTrackPurpose.md) | | [default to ScoreTrackPurpose.COMMON] +**url** | **str** | The URL of the track | [optional] +**media_id** | **str** | 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** | [**List[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [optional] + +## Example + +```python +from flat_api.models.score_track import ScoreTrack + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreTrack from a JSON string +score_track_instance = ScoreTrack.from_json(json) +# print the JSON string representation of the object +print(ScoreTrack.to_json()) + +# convert the object into a dict +score_track_dict = score_track_instance.to_dict() +# create an instance of ScoreTrack from a dict +score_track_from_dict = ScoreTrack.from_dict(score_track_dict) +``` +[[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/ScoreTrackCreation.md b/docs/reference/ScoreTrackCreation.md new file mode 100644 index 0000000..f49123d --- /dev/null +++ b/docs/reference/ScoreTrackCreation.md @@ -0,0 +1,35 @@ +# ScoreTrackCreation + +Creation of a new track. This one must contain the URL of the track or the corresponding file + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | Title of the track | [optional] +**default** | **bool** | True if the track should be used as default audio source | [optional] +**state** | [**ScoreTrackState**](ScoreTrackState.md) | | [optional] [default to ScoreTrackState.DRAFT] +**purpose** | [**ScoreTrackPurpose**](ScoreTrackPurpose.md) | | [optional] [default to ScoreTrackPurpose.COMMON] +**url** | **str** | The URL of the track | [optional] +**synchronization_points** | [**List[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [optional] + +## Example + +```python +from flat_api.models.score_track_creation import ScoreTrackCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreTrackCreation from a JSON string +score_track_creation_instance = ScoreTrackCreation.from_json(json) +# print the JSON string representation of the object +print(ScoreTrackCreation.to_json()) + +# convert the object into a dict +score_track_creation_dict = score_track_creation_instance.to_dict() +# create an instance of ScoreTrackCreation from a dict +score_track_creation_from_dict = ScoreTrackCreation.from_dict(score_track_creation_dict) +``` +[[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/ScoreTrackCreationResponse.md b/docs/reference/ScoreTrackCreationResponse.md new file mode 100644 index 0000000..216af53 --- /dev/null +++ b/docs/reference/ScoreTrackCreationResponse.md @@ -0,0 +1,30 @@ +# ScoreTrackCreationResponse + +Response for track creation including optional upload information + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**track** | [**ScoreTrack**](ScoreTrack.md) | | + +## Example + +```python +from flat_api.models.score_track_creation_response import ScoreTrackCreationResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreTrackCreationResponse from a JSON string +score_track_creation_response_instance = ScoreTrackCreationResponse.from_json(json) +# print the JSON string representation of the object +print(ScoreTrackCreationResponse.to_json()) + +# convert the object into a dict +score_track_creation_response_dict = score_track_creation_response_instance.to_dict() +# create an instance of ScoreTrackCreationResponse from a dict +score_track_creation_response_from_dict = ScoreTrackCreationResponse.from_dict(score_track_creation_response_dict) +``` +[[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/ScoreTrackPoint.md b/docs/reference/ScoreTrackPoint.md new file mode 100644 index 0000000..68cea4f --- /dev/null +++ b/docs/reference/ScoreTrackPoint.md @@ -0,0 +1,32 @@ +# ScoreTrackPoint + +A track synchronization point + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` | +**measure_uuid** | **UUID** | The measure unique identifier | [optional] +**time** | **float** | The corresponding time in seconds | + +## Example + +```python +from flat_api.models.score_track_point import ScoreTrackPoint + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreTrackPoint from a JSON string +score_track_point_instance = ScoreTrackPoint.from_json(json) +# print the JSON string representation of the object +print(ScoreTrackPoint.to_json()) + +# convert the object into a dict +score_track_point_dict = score_track_point_instance.to_dict() +# create an instance of ScoreTrackPoint from a dict +score_track_point_from_dict = ScoreTrackPoint.from_dict(score_track_point_dict) +``` +[[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/ClassStreamPostMode.md b/docs/reference/ScoreTrackPurpose.md similarity index 51% rename from docs/ClassStreamPostMode.md rename to docs/reference/ScoreTrackPurpose.md index 5e09af6..4032fba 100644 --- a/docs/ClassStreamPostMode.md +++ b/docs/reference/ScoreTrackPurpose.md @@ -1,8 +1,12 @@ -# ClassStreamPostMode +# ScoreTrackPurpose -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +The purpose of the audio track + +## Enum + +* `COMMON` (value: `'common'`) + +* `PERFORMANCESUBMISSION` (value: `'performanceSubmission'`) [[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/ScoreTrackState.md b/docs/reference/ScoreTrackState.md similarity index 58% rename from docs/ScoreTrackState.md rename to docs/reference/ScoreTrackState.md index 44955df..ec09aa3 100644 --- a/docs/ScoreTrackState.md +++ b/docs/reference/ScoreTrackState.md @@ -1,8 +1,14 @@ # ScoreTrackState -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +State of the track + +## Enum + +* `DRAFT` (value: `'draft'`) + +* `COMPLETED` (value: `'completed'`) + +* `DELETED` (value: `'deleted'`) [[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/ScoreTrackType.md b/docs/reference/ScoreTrackType.md similarity index 51% rename from docs/ScoreTrackType.md rename to docs/reference/ScoreTrackType.md index 265e6c6..30363bd 100644 --- a/docs/ScoreTrackType.md +++ b/docs/reference/ScoreTrackType.md @@ -1,8 +1,16 @@ # ScoreTrackType -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- +The type of an audio track + +## Enum + +* `AUDIO` (value: `'audio'`) + +* `SOUNDCLOUD` (value: `'soundcloud'`) + +* `YOUTUBE` (value: `'youtube'`) + +* `VIMEO` (value: `'vimeo'`) [[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/ScoreTrackUpdate.md b/docs/reference/ScoreTrackUpdate.md new file mode 100644 index 0000000..56e4db1 --- /dev/null +++ b/docs/reference/ScoreTrackUpdate.md @@ -0,0 +1,34 @@ +# ScoreTrackUpdate + +Update an existing track. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | Title of the track | [optional] +**default** | **bool** | True if the track should be used as default audio source | [optional] +**state** | [**ScoreTrackState**](ScoreTrackState.md) | | [optional] [default to ScoreTrackState.DRAFT] +**purpose** | [**ScoreTrackPurpose**](ScoreTrackPurpose.md) | | [optional] [default to ScoreTrackPurpose.COMMON] +**synchronization_points** | [**List[ScoreTrackPoint]**](ScoreTrackPoint.md) | | [optional] + +## Example + +```python +from flat_api.models.score_track_update import ScoreTrackUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreTrackUpdate from a JSON string +score_track_update_instance = ScoreTrackUpdate.from_json(json) +# print the JSON string representation of the object +print(ScoreTrackUpdate.to_json()) + +# convert the object into a dict +score_track_update_dict = score_track_update_instance.to_dict() +# create an instance of ScoreTrackUpdate from a dict +score_track_update_from_dict = ScoreTrackUpdate.from_dict(score_track_update_dict) +``` +[[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/ScoreViewsCounts.md b/docs/reference/ScoreViewsCounts.md new file mode 100644 index 0000000..269f207 --- /dev/null +++ b/docs/reference/ScoreViewsCounts.md @@ -0,0 +1,33 @@ +# ScoreViewsCounts + +A computed version of the total, weekly, monthly, and yearly number of views of the score + +## 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] + +## Example + +```python +from flat_api.models.score_views_counts import ScoreViewsCounts + +# TODO update the JSON string below +json = "{}" +# create an instance of ScoreViewsCounts from a JSON string +score_views_counts_instance = ScoreViewsCounts.from_json(json) +# print the JSON string representation of the object +print(ScoreViewsCounts.to_json()) + +# convert the object into a dict +score_views_counts_dict = score_views_counts_instance.to_dict() +# create an instance of ScoreViewsCounts from a dict +score_views_counts_from_dict = ScoreViewsCounts.from_dict(score_views_counts_dict) +``` +[[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/Task.md b/docs/reference/Task.md new file mode 100644 index 0000000..3da49d4 --- /dev/null +++ b/docs/reference/Task.md @@ -0,0 +1,43 @@ +# Task + +An asynchronous task + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the task | +**type** | **str** | 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** | **str** | State of the Task | +**format** | **str** | For files processing, the file format (e.g. `mp3`, `wav`) | [optional] +**score** | **str** | The score unique identifier for tasks related to scores | [optional] +**revision** | **str** | The score revision identifier for tasks related to scores | [optional] +**progress** | [**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** | [**TaskResult**](TaskResult.md) | | [optional] +**error_history** | **List[str]** | 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** | [**List[Task]**](Task.md) | Child tasks for hierarchical task structures (e.g., conversion subtasks) | [optional] + +## Example + +```python +from flat_api.models.task import Task + +# TODO update the JSON string below +json = "{}" +# create an instance of Task from a JSON string +task_instance = Task.from_json(json) +# print the JSON string representation of the object +print(Task.to_json()) + +# convert the object into a dict +task_dict = task_instance.to_dict() +# create an instance of Task from a dict +task_from_dict = Task.from_dict(task_dict) +``` +[[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/TaskApi.md b/docs/reference/TaskApi.md new file mode 100644 index 0000000..1c8092f --- /dev/null +++ b/docs/reference/TaskApi.md @@ -0,0 +1,86 @@ +# flat_api.TaskApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_task**](TaskApi.md#get_task) | **GET** /tasks/{task} | Get task details + + +# **get_task** +> Task get_task(task) + +Get task details + +This method can be used to follow the progress of a task, for example while a score is being exported. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.task import Task +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.TaskApi(api_client) + task = 'task_example' # str | Unique identifier for the task + + try: + # Get task details + api_response = api_instance.get_task(task) + print("The response of TaskApi->get_task:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TaskApi->get_task: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task** | **str**| Unique identifier for the task | + +### Return type + +[**Task**](Task.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Task details | - | +**0** | Error | - | + +[[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/reference/TaskExportOptions.md b/docs/reference/TaskExportOptions.md new file mode 100644 index 0000000..863b4a3 --- /dev/null +++ b/docs/reference/TaskExportOptions.md @@ -0,0 +1,30 @@ +# TaskExportOptions + +Options for the requested export + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parts** | **List[str]** | A list of parts to specifically export | [optional] + +## Example + +```python +from flat_api.models.task_export_options import TaskExportOptions + +# TODO update the JSON string below +json = "{}" +# create an instance of TaskExportOptions from a JSON string +task_export_options_instance = TaskExportOptions.from_json(json) +# print the JSON string representation of the object +print(TaskExportOptions.to_json()) + +# convert the object into a dict +task_export_options_dict = task_export_options_instance.to_dict() +# create an instance of TaskExportOptions from a dict +task_export_options_from_dict = TaskExportOptions.from_dict(task_export_options_dict) +``` +[[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/TaskProgress.md b/docs/reference/TaskProgress.md new file mode 100644 index 0000000..903b81d --- /dev/null +++ b/docs/reference/TaskProgress.md @@ -0,0 +1,31 @@ +# TaskProgress + +Details about the task progression + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**percent** | **float** | Percent of the task progression | [optional] +**text** | **str** | Text details of the task progress | [optional] + +## Example + +```python +from flat_api.models.task_progress import TaskProgress + +# TODO update the JSON string below +json = "{}" +# create an instance of TaskProgress from a JSON string +task_progress_instance = TaskProgress.from_json(json) +# print the JSON string representation of the object +print(TaskProgress.to_json()) + +# convert the object into a dict +task_progress_dict = task_progress_instance.to_dict() +# create an instance of TaskProgress from a dict +task_progress_from_dict = TaskProgress.from_dict(task_progress_dict) +``` +[[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/TaskResult.md b/docs/reference/TaskResult.md new file mode 100644 index 0000000..afa25e2 --- /dev/null +++ b/docs/reference/TaskResult.md @@ -0,0 +1,31 @@ +# TaskResult + +Optional result information about this task + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | URL of the generated file, when the task produces one | [optional] +**error** | **str** | Error message, when the task failed | [optional] + +## Example + +```python +from flat_api.models.task_result import TaskResult + +# TODO update the JSON string below +json = "{}" +# create an instance of TaskResult from a JSON string +task_result_instance = TaskResult.from_json(json) +# print the JSON string representation of the object +print(TaskResult.to_json()) + +# convert the object into a dict +task_result_dict = task_result_instance.to_dict() +# create an instance of TaskResult from a dict +task_result_from_dict = TaskResult.from_dict(task_result_dict) +``` +[[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/TeachingTheme.md b/docs/reference/TeachingTheme.md new file mode 100644 index 0000000..4a05a01 --- /dev/null +++ b/docs/reference/TeachingTheme.md @@ -0,0 +1,27 @@ +# TeachingTheme + +Teaching theme + +## Enum + +* `COMPOSITION` (value: `'composition'`) + +* `MUSIC_MINUS_THEORY` (value: `'music-theory'`) + +* `GENERAL_MINUS_MUSIC` (value: `'general-music'`) + +* `BAND` (value: `'band'`) + +* `CHOIR` (value: `'choir'`) + +* `ORCHESTRA` (value: `'orchestra'`) + +* `JAZZ_MINUS_ENSEMBLE` (value: `'jazz-ensemble'`) + +* `MUSIC_MINUS_TECHNOLOGY` (value: `'music-technology'`) + +* `OTHER` (value: `'other'`) + +[[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/TutteoProduct.md b/docs/reference/TutteoProduct.md new file mode 100644 index 0000000..7b4538a --- /dev/null +++ b/docs/reference/TutteoProduct.md @@ -0,0 +1,17 @@ +# TutteoProduct + +A Tutteo product. * `flat`: [Flat](https://flat.io) - Music notation software for individual users * `flatEdu`: [Flat for Education](https://flat.io/edu) - Music notation software for schools and educators * `msnippet`: [Music Snippet](https://musicsnippet.com) - Embeddable music snippets for websites * `embed`: [Flat Embed](https://flat.io/developers/embed) - Embeddable music notation editor + +## Enum + +* `FLAT` (value: `'flat'`) + +* `FLATEDU` (value: `'flatEdu'`) + +* `MSNIPPET` (value: `'msnippet'`) + +* `EMBED` (value: `'embed'`) + +[[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/UserAdminUpdate.md b/docs/reference/UserAdminUpdate.md new file mode 100644 index 0000000..cfcddd8 --- /dev/null +++ b/docs/reference/UserAdminUpdate.md @@ -0,0 +1,35 @@ +# UserAdminUpdate + +User update as an organization admin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**password** | **str** | Password of the account | [optional] +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] +**username** | **str** | Username of the account | [optional] +**firstname** | **str** | First name of the user | [optional] +**lastname** | **str** | Last name of the user | [optional] +**email** | **str** | Email of the account | [optional] + +## Example + +```python +from flat_api.models.user_admin_update import UserAdminUpdate + +# TODO update the JSON string below +json = "{}" +# create an instance of UserAdminUpdate from a JSON string +user_admin_update_instance = UserAdminUpdate.from_json(json) +# print the JSON string representation of the object +print(UserAdminUpdate.to_json()) + +# convert the object into a dict +user_admin_update_dict = user_admin_update_instance.to_dict() +# create an instance of UserAdminUpdate from a dict +user_admin_update_from_dict = UserAdminUpdate.from_dict(user_admin_update_dict) +``` +[[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/UserApi.md b/docs/reference/UserApi.md new file mode 100644 index 0000000..9b039ba --- /dev/null +++ b/docs/reference/UserApi.md @@ -0,0 +1,261 @@ +# flat_api.UserApi + +All URIs are relative to *https://api.flat.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_user**](UserApi.md#get_user) | **GET** /users/{user} | Get a public user profile +[**get_user_likes**](UserApi.md#get_user_likes) | **GET** /users/{user}/likes | List liked scores +[**get_user_scores**](UserApi.md#get_user_scores) | **GET** /users/{user}/scores | List user's scores + + +# **get_user** +> UserPublic get_user(user) + +Get a public user profile + +Get a profile of a Flat or Flat for Education User. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.user_public import UserPublic +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.UserApi(api_client) + user = 'user_example' # str | This route parameter is the unique identifier of the user. You can specify an email instead of a 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: + # Get a public user profile + api_response = api_instance.get_user(user) + print("The response of UserApi->get_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->get_user: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| This route parameter is the unique identifier of the user. You can specify an email instead of a 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 + +[**UserPublic**](UserPublic.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The user public details | - | +**0** | Error | - | + +[[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) + +# **get_user_likes** +> List[ScoreDetails] get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids) + +List liked scores + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.UserApi(api_client) + user = 'user_example' # str | Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. + next = 'next_example' # str | 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 = 'previous_example' # str | 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 = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + ids = True # bool | Return only the identifiers of the scores (optional) + + try: + # List liked scores + api_response = api_instance.get_user_likes(user, next=next, previous=previous, limit=limit, ids=ids) + print("The response of UserApi->get_user_likes:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->get_user_likes: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. | + **next** | **str**| 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** | **str**| 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 + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of liked scores | - | +**0** | Error | - | + +[[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) + +# **get_user_scores** +> List[ScoreDetails] get_user_scores(user, paginate=paginate, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + +List user's scores + +Get the list of public scores owned by a User. +If you want to access private scores, please use the [Collections API](#tag/Collection). +For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + +### Example + +* OAuth Authentication (OAuth2): + +```python +import flat_api +from flat_api.models.score_details import ScoreDetails +from flat_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.flat.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = flat_api.Configuration( + host = "https://api.flat.io/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with flat_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flat_api.UserApi(api_client) + user = 'user_example' # str | 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. (optional) (default to False) + sort = 'sort_example' # str | Sort (optional) + direction = 'direction_example' # str | Sort direction (optional) + limit = 25 # int | This is the maximum number of objects that may be returned (optional) (default to 25) + next = 'next_example' # str | 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 = 'previous_example' # str | 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) + + try: + # List user's scores + api_response = api_instance.get_user_scores(user, paginate=paginate, sort=sort, direction=direction, limit=limit, next=next, previous=previous) + print("The response of UserApi->get_user_scores:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->get_user_scores: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **str**| 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** | **str**| Sort | [optional] + **direction** | **str**| Sort direction | [optional] + **limit** | **int**| This is the maximum number of objects that may be returned | [optional] [default to 25] + **next** | **str**| 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** | **str**| 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 + +[**List[ScoreDetails]**](ScoreDetails.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The user scores | - | +**0** | Error | - | + +[[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/reference/UserAzureDetails.md b/docs/reference/UserAzureDetails.md new file mode 100644 index 0000000..5ddd467 --- /dev/null +++ b/docs/reference/UserAzureDetails.md @@ -0,0 +1,31 @@ +# UserAzureDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**oid** | **str** | User object identifier on Azure AD | [optional] +**hd** | **str** | User tenant (domain name) | [optional] +**preferred_username** | **str** | User Preferred Username (UPN), i.e. the main email of the user | [optional] + +## Example + +```python +from flat_api.models.user_azure_details import UserAzureDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of UserAzureDetails from a JSON string +user_azure_details_instance = UserAzureDetails.from_json(json) +# print the JSON string representation of the object +print(UserAzureDetails.to_json()) + +# convert the object into a dict +user_azure_details_dict = user_azure_details_instance.to_dict() +# create an instance of UserAzureDetails from a dict +user_azure_details_from_dict = UserAzureDetails.from_dict(user_azure_details_dict) +``` +[[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/UserBasics.md b/docs/reference/UserBasics.md new file mode 100644 index 0000000..5cbbf03 --- /dev/null +++ b/docs/reference/UserBasics.md @@ -0,0 +1,38 @@ +# UserBasics + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The user unique identifier | +**type** | **str** | The type of user account | +**product** | [**TutteoProduct**](TutteoProduct.md) | | [default to TutteoProduct.FLAT] +**username** | **str** | The user name (unique for the organization) | +**printable_name** | **str** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **str** | Firstname of the user (for education users) | [optional] +**lastname** | **str** | Lastname of the user (for education users) | [optional] +**name** | **str** | A displayable name for the user (for consumer users) | [optional] +**picture** | **str** | The URL of the picture to display | +**badges** | **List[str]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] + +## Example + +```python +from flat_api.models.user_basics import UserBasics + +# TODO update the JSON string below +json = "{}" +# create an instance of UserBasics from a JSON string +user_basics_instance = UserBasics.from_json(json) +# print the JSON string representation of the object +print(UserBasics.to_json()) + +# convert the object into a dict +user_basics_dict = user_basics_instance.to_dict() +# create an instance of UserBasics from a dict +user_basics_from_dict = UserBasics.from_dict(user_basics_dict) +``` +[[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/UserCommunityProfileLinks.md b/docs/reference/UserCommunityProfileLinks.md new file mode 100644 index 0000000..a6f6807 --- /dev/null +++ b/docs/reference/UserCommunityProfileLinks.md @@ -0,0 +1,35 @@ +# UserCommunityProfileLinks + +Social networks links + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**spotify_url** | **str** | Spotify Profile URL | [optional] +**youtube_url** | **str** | YouTube channel URL | [optional] +**soundcloud_url** | **str** | SoundCloud Profile URL | [optional] +**tiktok_url** | **str** | TikTok profile URL. For updates, also accepts TikTok usernames | [optional] +**instagram_url** | **str** | Instagram profile URL. For updates, also accepts Instagram usernames | [optional] +**website_url** | **str** | Personal website URL | [optional] + +## Example + +```python +from flat_api.models.user_community_profile_links import UserCommunityProfileLinks + +# TODO update the JSON string below +json = "{}" +# create an instance of UserCommunityProfileLinks from a JSON string +user_community_profile_links_instance = UserCommunityProfileLinks.from_json(json) +# print the JSON string representation of the object +print(UserCommunityProfileLinks.to_json()) + +# convert the object into a dict +user_community_profile_links_dict = user_community_profile_links_instance.to_dict() +# create an instance of UserCommunityProfileLinks from a dict +user_community_profile_links_from_dict = UserCommunityProfileLinks.from_dict(user_community_profile_links_dict) +``` +[[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/UserCreation.md b/docs/reference/UserCreation.md new file mode 100644 index 0000000..1e60190 --- /dev/null +++ b/docs/reference/UserCreation.md @@ -0,0 +1,36 @@ +# UserCreation + +User creation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | Username of the new account | +**firstname** | **str** | First name of the user | [optional] +**lastname** | **str** | Last name of the user | [optional] +**email** | **str** | Email of the new account | [optional] +**password** | **str** | Password of the new account | +**locale** | **str** | User language. Input values will be automatically normalized to a supported locale code. | [optional] [default to 'en'] +**role** | **str** | Role of the new account | [optional] [default to 'user'] + +## Example + +```python +from flat_api.models.user_creation import UserCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of UserCreation from a JSON string +user_creation_instance = UserCreation.from_json(json) +# print the JSON string representation of the object +print(UserCreation.to_json()) + +# convert the object into a dict +user_creation_dict = user_creation_instance.to_dict() +# create an instance of UserCreation from a dict +user_creation_from_dict = UserCreation.from_dict(user_creation_dict) +``` +[[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/UserDetails.md b/docs/reference/UserDetails.md new file mode 100644 index 0000000..f06b137 --- /dev/null +++ b/docs/reference/UserDetails.md @@ -0,0 +1,62 @@ +# UserDetails + +User details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The user unique identifier | +**type** | **str** | The type of user account | +**product** | [**TutteoProduct**](TutteoProduct.md) | | [default to TutteoProduct.FLAT] +**username** | **str** | The user name (unique for the organization) | +**printable_name** | **str** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **str** | Firstname of the user (for education users) | [optional] +**lastname** | **str** | Lastname of the user (for education users) | [optional] +**name** | **str** | A displayable name for the user (for consumer users) | [optional] +**picture** | **str** | The URL of the picture to display | +**badges** | **List[str]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **str** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **str** | Link to user profile (for Indiv. users only) | [optional] +**bio** | **str** | 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 has | [optional] +**following_count** | **int** | Number of people the user follows | [optional] +**owned_public_scores_count** | **int** | Number of public scores the user owns | [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** | **str** | Cover picture (background) for the profile | [optional] +**profile_theme** | **str** | Theme (background) for the profile | [optional] +**links** | [**UserCommunityProfileLinks**](UserCommunityProfileLinks.md) | | [optional] +**is_email_verified** | **bool** | Whether the user's email address has been verified | [optional] +**azure_details** | [**UserAzureDetails**](UserAzureDetails.md) | | [optional] +**private_profile** | **bool** | Whether this user profile is private (individual accounts only) | [optional] +**locale** | **str** | 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** | **List[str]** | For Flat for Education accounts, list of Group identifiers the user is part of. | [optional] +**picture_file** | **str** | The ID of the user profile picture | [optional] +**cover_picture_file** | **str** | The ID of the user profile cover picture | [optional] + +## Example + +```python +from flat_api.models.user_details import UserDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of UserDetails from a JSON string +user_details_instance = UserDetails.from_json(json) +# print the JSON string representation of the object +print(UserDetails.to_json()) + +# convert the object into a dict +user_details_dict = user_details_instance.to_dict() +# create an instance of UserDetails from a dict +user_details_from_dict = UserDetails.from_dict(user_details_dict) +``` +[[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/UserDetailsAdmin.md b/docs/reference/UserDetailsAdmin.md new file mode 100644 index 0000000..4d0a98f --- /dev/null +++ b/docs/reference/UserDetailsAdmin.md @@ -0,0 +1,48 @@ +# UserDetailsAdmin + +User details (view for organization teacher / admin) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The user unique identifier | +**type** | **str** | The type of user account | +**product** | [**TutteoProduct**](TutteoProduct.md) | | [default to TutteoProduct.FLAT] +**username** | **str** | The user name (unique for the organization) | +**printable_name** | **str** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **str** | Firstname of the user (for education users) | [optional] +**lastname** | **str** | Lastname of the user (for education users) | [optional] +**name** | **str** | A displayable name for the user (for consumer users) | [optional] +**picture** | **str** | The URL of the picture to display | +**badges** | **List[str]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **str** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **str** | Link to user profile (for Indiv. users only) | [optional] +**email** | **str** | Email of the user | [optional] +**last_activity_date** | **datetime** | Date of the last user activity | [optional] +**license** | [**UserDetailsAdminAllOfLicense**](UserDetailsAdminAllOfLicense.md) | | [optional] +**groups** | **List[str]** | 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] + +## Example + +```python +from flat_api.models.user_details_admin import UserDetailsAdmin + +# TODO update the JSON string below +json = "{}" +# create an instance of UserDetailsAdmin from a JSON string +user_details_admin_instance = UserDetailsAdmin.from_json(json) +# print the JSON string representation of the object +print(UserDetailsAdmin.to_json()) + +# convert the object into a dict +user_details_admin_dict = user_details_admin_instance.to_dict() +# create an instance of UserDetailsAdmin from a dict +user_details_admin_from_dict = UserDetailsAdmin.from_dict(user_details_admin_dict) +``` +[[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/UserDetailsAdminAllOfLicense.md b/docs/reference/UserDetailsAdminAllOfLicense.md new file mode 100644 index 0000000..1e63371 --- /dev/null +++ b/docs/reference/UserDetailsAdminAllOfLicense.md @@ -0,0 +1,34 @@ +# UserDetailsAdminAllOfLicense + +Current active license of the user + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | ID of the current license | [optional] +**expiration_date** | **datetime** | Date when the license expires | [optional] +**source** | [**LicenseSources**](LicenseSources.md) | | [optional] [default to LicenseSources.ORDER] +**mode** | [**LicenseMode**](LicenseMode.md) | | [optional] +**active** | **bool** | Whether the license is currently active | [optional] + +## Example + +```python +from flat_api.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense + +# TODO update the JSON string below +json = "{}" +# create an instance of UserDetailsAdminAllOfLicense from a JSON string +user_details_admin_all_of_license_instance = UserDetailsAdminAllOfLicense.from_json(json) +# print the JSON string representation of the object +print(UserDetailsAdminAllOfLicense.to_json()) + +# convert the object into a dict +user_details_admin_all_of_license_dict = user_details_admin_all_of_license_instance.to_dict() +# create an instance of UserDetailsAdminAllOfLicense from a dict +user_details_admin_all_of_license_from_dict = UserDetailsAdminAllOfLicense.from_dict(user_details_admin_all_of_license_dict) +``` +[[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/UserPublic.md b/docs/reference/UserPublic.md new file mode 100644 index 0000000..b9b3f66 --- /dev/null +++ b/docs/reference/UserPublic.md @@ -0,0 +1,55 @@ +# UserPublic + +Public User details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The user unique identifier | +**type** | **str** | The type of user account | +**product** | [**TutteoProduct**](TutteoProduct.md) | | [default to TutteoProduct.FLAT] +**username** | **str** | The user name (unique for the organization) | +**printable_name** | **str** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **str** | Firstname of the user (for education users) | [optional] +**lastname** | **str** | Lastname of the user (for education users) | [optional] +**name** | **str** | A displayable name for the user (for consumer users) | [optional] +**picture** | **str** | The URL of the picture to display | +**badges** | **List[str]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **str** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **str** | Link to user profile (for Indiv. users only) | [optional] +**bio** | **str** | 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 has | [optional] +**following_count** | **int** | Number of people the user follows | [optional] +**owned_public_scores_count** | **int** | Number of public scores the user owns | [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** | **str** | Cover picture (background) for the profile | [optional] +**profile_theme** | **str** | Theme (background) for the profile | [optional] +**links** | [**UserCommunityProfileLinks**](UserCommunityProfileLinks.md) | | [optional] + +## Example + +```python +from flat_api.models.user_public import UserPublic + +# TODO update the JSON string below +json = "{}" +# create an instance of UserPublic from a JSON string +user_public_instance = UserPublic.from_json(json) +# print the JSON string representation of the object +print(UserPublic.to_json()) + +# convert the object into a dict +user_public_dict = user_public_instance.to_dict() +# create an instance of UserPublic from a dict +user_public_from_dict = UserPublic.from_dict(user_public_dict) +``` +[[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/UserPublicSummary.md b/docs/reference/UserPublicSummary.md new file mode 100644 index 0000000..720e7c8 --- /dev/null +++ b/docs/reference/UserPublicSummary.md @@ -0,0 +1,43 @@ +# UserPublicSummary + +Public User details summary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The user unique identifier | +**type** | **str** | The type of user account | +**product** | [**TutteoProduct**](TutteoProduct.md) | | [default to TutteoProduct.FLAT] +**username** | **str** | The user name (unique for the organization) | +**printable_name** | **str** | The name that can be directly printed (name, firstname & lastname, or username) | [optional] +**firstname** | **str** | Firstname of the user (for education users) | [optional] +**lastname** | **str** | Lastname of the user (for education users) | [optional] +**name** | **str** | A displayable name for the user (for consumer users) | [optional] +**picture** | **str** | The URL of the picture to display | +**badges** | **List[str]** | List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` | [optional] +**organization** | **str** | Organization ID (for Edu users only) | [optional] +**organization_role** | [**OrganizationRoles**](OrganizationRoles.md) | | [optional] +**class_role** | [**ClassRoles**](ClassRoles.md) | | [optional] +**html_url** | **str** | Link to user profile (for Indiv. users only) | [optional] + +## Example + +```python +from flat_api.models.user_public_summary import UserPublicSummary + +# TODO update the JSON string below +json = "{}" +# create an instance of UserPublicSummary from a JSON string +user_public_summary_instance = UserPublicSummary.from_json(json) +# print the JSON string representation of the object +print(UserPublicSummary.to_json()) + +# convert the object into a dict +user_public_summary_dict = user_public_summary_instance.to_dict() +# create an instance of UserPublicSummary from a dict +user_public_summary_from_dict = UserPublicSummary.from_dict(user_public_summary_dict) +``` +[[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/UserSigninLink.md b/docs/reference/UserSigninLink.md new file mode 100644 index 0000000..f888803 --- /dev/null +++ b/docs/reference/UserSigninLink.md @@ -0,0 +1,31 @@ +# UserSigninLink + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | URL to use to sign in to this account | [optional] +**token** | **str** | 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] + +## Example + +```python +from flat_api.models.user_signin_link import UserSigninLink + +# TODO update the JSON string below +json = "{}" +# create an instance of UserSigninLink from a JSON string +user_signin_link_instance = UserSigninLink.from_json(json) +# print the JSON string representation of the object +print(UserSigninLink.to_json()) + +# convert the object into a dict +user_signin_link_dict = user_signin_link_instance.to_dict() +# create an instance of UserSigninLink from a dict +user_signin_link_from_dict = UserSigninLink.from_dict(user_signin_link_dict) +``` +[[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/UserSigninLinkCreation.md b/docs/reference/UserSigninLinkCreation.md new file mode 100644 index 0000000..0a15746 --- /dev/null +++ b/docs/reference/UserSigninLinkCreation.md @@ -0,0 +1,29 @@ +# UserSigninLinkCreation + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination_path** | **str** | Path to redirect to after signin | [optional] [default to '/'] + +## Example + +```python +from flat_api.models.user_signin_link_creation import UserSigninLinkCreation + +# TODO update the JSON string below +json = "{}" +# create an instance of UserSigninLinkCreation from a JSON string +user_signin_link_creation_instance = UserSigninLinkCreation.from_json(json) +# print the JSON string representation of the object +print(UserSigninLinkCreation.to_json()) + +# convert the object into a dict +user_signin_link_creation_dict = user_signin_link_creation_instance.to_dict() +# create an instance of UserSigninLinkCreation from a dict +user_signin_link_creation_from_dict = UserSigninLinkCreation.from_dict(user_signin_link_creation_dict) +``` +[[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/flat_api/__init__.py b/flat_api/__init__.py index b572265..0260bc4 100644 --- a/flat_api/__init__.py +++ b/flat_api/__init__.py @@ -1,3 +1,50 @@ +"""Flat API client. + + from flat_api import FlatClient + client = FlatClient(access_token="...") + +Async: + + from flat_api import AsyncFlatClient + client = AsyncFlatClient(access_token="...") +""" + +# --- flat_api ergonomic surface (tools/patches/90_exports.py) --- +__version__ = "2.0.4" + +from flat_api.client import AsyncFlatClient, FlatClient +from flat_api.errors import ( + FlatAuthenticationError, + FlatAuthorizationError, + FlatError, + FlatNotFoundError, + FlatQuotaError, + FlatRateLimitError, + FlatServerError, + FlatValidationError, +) +from flat_api.oauth import OAuth2Helper, Tokens +from flat_api.pagination import paginate +from flat_api._retry import RetryPolicy + +__all__ = [ + "AsyncFlatClient", + "FlatClient", + "FlatAuthenticationError", + "FlatAuthorizationError", + "FlatError", + "FlatNotFoundError", + "FlatQuotaError", + "FlatRateLimitError", + "FlatServerError", + "FlatValidationError", + "OAuth2Helper", + "RetryPolicy", + "Tokens", + "paginate", + "__version__", +] +# --- end --- # coding: utf-8 # flake8: noqa @@ -5,106 +52,455 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import +__version__ = "2.0.4" + +# Define package exports +__all__ = [ + "AccountApi", + "ClassApi", + "CollectionApi", + "EduResourcesApi", + "GroupApi", + "OMRApi", + "OrganizationApi", + "ScoreApi", + "TaskApi", + "UserApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "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", + "OmrCapabilities", + "OmrDetailsStepData", + "OmrDetailsSubmission", + "OmrDetectedInstrument", + "OmrImportedMetadata", + "OmrInstrumentOverride", + "OmrJob", + "OmrJobCreation", + "OmrJobFileMetadata", + "OmrJobFileUpload", + "OmrJobFileUploadResult", + "OmrJobInputFile", + "OmrJobOutput", + "OmrJobProgress", + "OmrJobResult", + "OmrJobRetention", + "OmrJobStatus", + "OmrLocaleDetails", + "OmrPendingStep", + "OmrStepName", + "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", +] # import apis into sdk package -from flat_api.api.account_api import AccountApi -from flat_api.api.class_api import ClassApi -from flat_api.api.collection_api import CollectionApi -from flat_api.api.group_api import GroupApi -from flat_api.api.organization_api import OrganizationApi -from flat_api.api.score_api import ScoreApi -from flat_api.api.user_api import UserApi +from flat_api.api.account_api import AccountApi as AccountApi +from flat_api.api.class_api import ClassApi as ClassApi +from flat_api.api.collection_api import CollectionApi as CollectionApi +from flat_api.api.edu_resources_api import EduResourcesApi as EduResourcesApi +from flat_api.api.group_api import GroupApi as GroupApi +from flat_api.api.omr_api import OMRApi as OMRApi +from flat_api.api.organization_api import OrganizationApi as OrganizationApi +from flat_api.api.score_api import ScoreApi as ScoreApi +from flat_api.api.task_api import TaskApi as TaskApi +from flat_api.api.user_api import UserApi as UserApi # import ApiClient -from flat_api.api_client import ApiClient -from flat_api.configuration import Configuration +from flat_api.api_response import ApiResponse as ApiResponse +from flat_api.api_client import ApiClient as ApiClient +from flat_api.configuration import Configuration as Configuration +from flat_api.exceptions import OpenApiException as OpenApiException +from flat_api.exceptions import ApiTypeError as ApiTypeError +from flat_api.exceptions import ApiValueError as ApiValueError +from flat_api.exceptions import ApiKeyError as ApiKeyError +from flat_api.exceptions import ApiAttributeError as ApiAttributeError +from flat_api.exceptions import ApiException as ApiException + # import models into sdk package -from flat_api.models.assignment import Assignment -from flat_api.models.assignment_copy import AssignmentCopy -from flat_api.models.assignment_creation import AssignmentCreation -from flat_api.models.assignment_submission import AssignmentSubmission -from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate -from flat_api.models.class_attachment_creation import ClassAttachmentCreation -from flat_api.models.class_creation import ClassCreation -from flat_api.models.class_details import ClassDetails -from flat_api.models.class_details_canvas import ClassDetailsCanvas -from flat_api.models.class_details_clever import ClassDetailsClever -from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom -from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive -from flat_api.models.class_details_lti import ClassDetailsLti -from flat_api.models.class_roles import ClassRoles -from flat_api.models.class_state import ClassState -from flat_api.models.class_update import ClassUpdate -from flat_api.models.collection import Collection -from flat_api.models.collection_capabilities import CollectionCapabilities -from flat_api.models.collection_creation import CollectionCreation -from flat_api.models.collection_modification import CollectionModification -from flat_api.models.collection_privacy import CollectionPrivacy -from flat_api.models.collection_title import CollectionTitle -from flat_api.models.collection_type import CollectionType -from flat_api.models.flat_error_response import FlatErrorResponse -from flat_api.models.flat_locales import FlatLocales -from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework -from flat_api.models.google_classroom_submission import GoogleClassroomSubmission -from flat_api.models.group import Group -from flat_api.models.group_details import GroupDetails -from flat_api.models.group_type import GroupType -from flat_api.models.license_mode import LicenseMode -from flat_api.models.license_sources import LicenseSources -from flat_api.models.lms_name import LmsName -from flat_api.models.lti_credentials import LtiCredentials -from flat_api.models.lti_credentials_creation import LtiCredentialsCreation -from flat_api.models.media_attachment import MediaAttachment -from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode -from flat_api.models.organization_invitation import OrganizationInvitation -from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation -from flat_api.models.organization_roles import OrganizationRoles -from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation -from flat_api.models.resource_rights import ResourceRights -from flat_api.models.resource_sharing_key import ResourceSharingKey -from flat_api.models.score_comment import ScoreComment -from flat_api.models.score_comment_context import ScoreCommentContext -from flat_api.models.score_comment_creation import ScoreCommentCreation -from flat_api.models.score_comment_update import ScoreCommentUpdate -from flat_api.models.score_comments_counts import ScoreCommentsCounts -from flat_api.models.score_creation import ScoreCreation -from flat_api.models.score_creation_type import ScoreCreationType -from flat_api.models.score_data import ScoreData -from flat_api.models.score_data_encoding import ScoreDataEncoding -from flat_api.models.score_fork import ScoreFork -from flat_api.models.score_license import ScoreLicense -from flat_api.models.score_likes_counts import ScoreLikesCounts -from flat_api.models.score_modification import ScoreModification -from flat_api.models.score_privacy import ScorePrivacy -from flat_api.models.score_revision import ScoreRevision -from flat_api.models.score_revision_creation import ScoreRevisionCreation -from flat_api.models.score_revision_statistics import ScoreRevisionStatistics -from flat_api.models.score_source import ScoreSource -from flat_api.models.score_summary import ScoreSummary -from flat_api.models.score_track import ScoreTrack -from flat_api.models.score_track_creation import ScoreTrackCreation -from flat_api.models.score_track_point import ScoreTrackPoint -from flat_api.models.score_track_state import ScoreTrackState -from flat_api.models.score_track_type import ScoreTrackType -from flat_api.models.score_track_update import ScoreTrackUpdate -from flat_api.models.score_views_counts import ScoreViewsCounts -from flat_api.models.user_admin_update import UserAdminUpdate -from flat_api.models.user_basics import UserBasics -from flat_api.models.user_creation import UserCreation -from flat_api.models.user_details_admin_license import UserDetailsAdminLicense -from flat_api.models.user_instruments import UserInstruments -from flat_api.models.resource_collaborator import ResourceCollaborator -from flat_api.models.score_details import ScoreDetails -from flat_api.models.user_public_summary import UserPublicSummary -from flat_api.models.user_details_admin import UserDetailsAdmin -from flat_api.models.user_public import UserPublic -from flat_api.models.user_details import UserDetails +from flat_api.models.add_group_user200_response import AddGroupUser200Response as AddGroupUser200Response +from flat_api.models.add_group_user_request import AddGroupUserRequest as AddGroupUserRequest +from flat_api.models.api_access_token import ApiAccessToken as ApiAccessToken +from flat_api.models.app_scopes import AppScopes as AppScopes +from flat_api.models.assignment import Assignment as Assignment +from flat_api.models.assignment_capabilities import AssignmentCapabilities as AssignmentCapabilities +from flat_api.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError as AssignmentCapabilitiesCanPublishInClassError +from flat_api.models.assignment_copy import AssignmentCopy as AssignmentCopy +from flat_api.models.assignment_copy_response import AssignmentCopyResponse as AssignmentCopyResponse +from flat_api.models.assignment_copy_to_class import AssignmentCopyToClass as AssignmentCopyToClass +from flat_api.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary as AssignmentCopyToResourceLibrary +from flat_api.models.assignment_group import AssignmentGroup as AssignmentGroup +from flat_api.models.assignment_submission import AssignmentSubmission as AssignmentSubmission +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment as AssignmentSubmissionComment +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation as AssignmentSubmissionCommentCreation +from flat_api.models.assignment_submission_comments import AssignmentSubmissionComments as AssignmentSubmissionComments +from flat_api.models.assignment_submission_history import AssignmentSubmissionHistory as AssignmentSubmissionHistory +from flat_api.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment as AssignmentSubmissionHistoryAttachment +from flat_api.models.assignment_submission_history_state import AssignmentSubmissionHistoryState as AssignmentSubmissionHistoryState +from flat_api.models.assignment_submission_lti import AssignmentSubmissionLti as AssignmentSubmissionLti +from flat_api.models.assignment_submission_playback import AssignmentSubmissionPlayback as AssignmentSubmissionPlayback +from flat_api.models.assignment_submission_state import AssignmentSubmissionState as AssignmentSubmissionState +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode as AssignmentSubmissionStudentsMode +from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate as AssignmentSubmissionUpdate +from flat_api.models.assignment_type import AssignmentType as AssignmentType +from flat_api.models.assignment_update import AssignmentUpdate as AssignmentUpdate +from flat_api.models.class_assignment import ClassAssignment as ClassAssignment +from flat_api.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas as ClassAssignmentAllOfCanvas +from flat_api.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti as ClassAssignmentAllOfLti +from flat_api.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc as ClassAssignmentAllOfMfc +from flat_api.models.class_assignment_update import ClassAssignmentUpdate as ClassAssignmentUpdate +from flat_api.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom as ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph as ClassAssignmentUpdateAllOfMicrosoftGraph +from flat_api.models.class_attachment_creation import ClassAttachmentCreation as ClassAttachmentCreation +from flat_api.models.class_creation import ClassCreation as ClassCreation +from flat_api.models.class_details import ClassDetails as ClassDetails +from flat_api.models.class_details_canvas import ClassDetailsCanvas as ClassDetailsCanvas +from flat_api.models.class_details_clever import ClassDetailsClever as ClassDetailsClever +from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom as ClassDetailsGoogleClassroom +from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive as ClassDetailsGoogleDrive +from flat_api.models.class_details_issues import ClassDetailsIssues as ClassDetailsIssues +from flat_api.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner as ClassDetailsIssuesSyncInner +from flat_api.models.class_details_lti import ClassDetailsLti as ClassDetailsLti +from flat_api.models.class_details_mfc import ClassDetailsMfc as ClassDetailsMfc +from flat_api.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph as ClassDetailsMicrosoftGraph +from flat_api.models.class_grade_level import ClassGradeLevel as ClassGradeLevel +from flat_api.models.class_roles import ClassRoles as ClassRoles +from flat_api.models.class_state import ClassState as ClassState +from flat_api.models.class_update import ClassUpdate as ClassUpdate +from flat_api.models.collection import Collection as Collection +from flat_api.models.collection_app import CollectionApp as CollectionApp +from flat_api.models.collection_capabilities import CollectionCapabilities as CollectionCapabilities +from flat_api.models.collection_contents import CollectionContents as CollectionContents +from flat_api.models.collection_creation import CollectionCreation as CollectionCreation +from flat_api.models.collection_modification import CollectionModification as CollectionModification +from flat_api.models.collection_privacy import CollectionPrivacy as CollectionPrivacy +from flat_api.models.collection_type import CollectionType as CollectionType +from flat_api.models.credit_transaction import CreditTransaction as CreditTransaction +from flat_api.models.edu_library import EduLibrary as EduLibrary +from flat_api.models.edu_resource import EduResource as EduResource +from flat_api.models.edu_resource_assignment_creation import EduResourceAssignmentCreation as EduResourceAssignmentCreation +from flat_api.models.edu_resource_capabilities import EduResourceCapabilities as EduResourceCapabilities +from flat_api.models.edu_resource_copy import EduResourceCopy as EduResourceCopy +from flat_api.models.edu_resource_creation import EduResourceCreation as EduResourceCreation +from flat_api.models.edu_resource_folder import EduResourceFolder as EduResourceFolder +from flat_api.models.edu_resource_lti_link import EduResourceLtiLink as EduResourceLtiLink +from flat_api.models.edu_resource_move import EduResourceMove as EduResourceMove +from flat_api.models.edu_resource_privacy import EduResourcePrivacy as EduResourcePrivacy +from flat_api.models.edu_resource_resource import EduResourceResource as EduResourceResource +from flat_api.models.edu_resource_type import EduResourceType as EduResourceType +from flat_api.models.edu_resource_update import EduResourceUpdate as EduResourceUpdate +from flat_api.models.edu_resource_use_in_class import EduResourceUseInClass as EduResourceUseInClass +from flat_api.models.flat_error_response import FlatErrorResponse as FlatErrorResponse +from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework as GoogleClassroomCoursework +from flat_api.models.google_classroom_submission import GoogleClassroomSubmission as GoogleClassroomSubmission +from flat_api.models.grade import Grade as Grade +from flat_api.models.group import Group as Group +from flat_api.models.group_creation import GroupCreation as GroupCreation +from flat_api.models.group_details import GroupDetails as GroupDetails +from flat_api.models.group_type import GroupType as GroupType +from flat_api.models.license_mode import LicenseMode as LicenseMode +from flat_api.models.license_sources import LicenseSources as LicenseSources +from flat_api.models.lms_name import LmsName as LmsName +from flat_api.models.lti_configuration import LtiConfiguration as LtiConfiguration +from flat_api.models.lti_configuration1p1 import LtiConfiguration1p1 as LtiConfiguration1p1 +from flat_api.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool as LtiConfiguration1p1AllOfTool +from flat_api.models.lti_configuration1p3 import LtiConfiguration1p3 as LtiConfiguration1p3 +from flat_api.models.lti_configuration1p3_base import LtiConfiguration1p3Base as LtiConfiguration1p3Base +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices as LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs as LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking as LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps as LtiConfiguration1p3BaseSupportedServicesNrps +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool as LtiConfiguration1p3BaseTool +from flat_api.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment as LtiConfiguration1p3Deployment +from flat_api.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic as LtiConfiguration1p3Dynamic +from flat_api.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual as LtiConfiguration1p3Manual +from flat_api.models.lti_configuration_base import LtiConfigurationBase as LtiConfigurationBase +from flat_api.models.lti_configuration_create import LtiConfigurationCreate as LtiConfigurationCreate +from flat_api.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 as LtiConfigurationCreate1p1 +from flat_api.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment as LtiConfigurationCreate1p3Deployment +from flat_api.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic as LtiConfigurationCreate1p3Dynamic +from flat_api.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo as LtiConfigurationCreate1p3DynamicPlatformInfo +from flat_api.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual as LtiConfigurationCreate1p3Manual +from flat_api.models.lti_configuration_update import LtiConfigurationUpdate as LtiConfigurationUpdate +from flat_api.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment as LtiConfigurationUpdateDeployment +from flat_api.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone as LtiConfigurationUpdateStandalone +from flat_api.models.lti_credentials import LtiCredentials as LtiCredentials +from flat_api.models.lti_credentials_creation import LtiCredentialsCreation as LtiCredentialsCreation +from flat_api.models.media_attachment import MediaAttachment as MediaAttachment +from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode as MediaScoreSharingMode +from flat_api.models.microsoft_graph_assignment import MicrosoftGraphAssignment as MicrosoftGraphAssignment +from flat_api.models.microsoft_graph_submission import MicrosoftGraphSubmission as MicrosoftGraphSubmission +from flat_api.models.omr_capabilities import OmrCapabilities as OmrCapabilities +from flat_api.models.omr_details_step_data import OmrDetailsStepData as OmrDetailsStepData +from flat_api.models.omr_details_submission import OmrDetailsSubmission as OmrDetailsSubmission +from flat_api.models.omr_detected_instrument import OmrDetectedInstrument as OmrDetectedInstrument +from flat_api.models.omr_imported_metadata import OmrImportedMetadata as OmrImportedMetadata +from flat_api.models.omr_instrument_override import OmrInstrumentOverride as OmrInstrumentOverride +from flat_api.models.omr_job import OmrJob as OmrJob +from flat_api.models.omr_job_creation import OmrJobCreation as OmrJobCreation +from flat_api.models.omr_job_file_metadata import OmrJobFileMetadata as OmrJobFileMetadata +from flat_api.models.omr_job_file_upload import OmrJobFileUpload as OmrJobFileUpload +from flat_api.models.omr_job_file_upload_result import OmrJobFileUploadResult as OmrJobFileUploadResult +from flat_api.models.omr_job_input_file import OmrJobInputFile as OmrJobInputFile +from flat_api.models.omr_job_output import OmrJobOutput as OmrJobOutput +from flat_api.models.omr_job_progress import OmrJobProgress as OmrJobProgress +from flat_api.models.omr_job_result import OmrJobResult as OmrJobResult +from flat_api.models.omr_job_retention import OmrJobRetention as OmrJobRetention +from flat_api.models.omr_job_status import OmrJobStatus as OmrJobStatus +from flat_api.models.omr_locale_details import OmrLocaleDetails as OmrLocaleDetails +from flat_api.models.omr_pending_step import OmrPendingStep as OmrPendingStep +from flat_api.models.omr_step_name import OmrStepName as OmrStepName +from flat_api.models.organization_invitation import OrganizationInvitation as OrganizationInvitation +from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation as OrganizationInvitationCreation +from flat_api.models.organization_roles import OrganizationRoles as OrganizationRoles +from flat_api.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation as OrganizationUserAccessTokenCreation +from flat_api.models.rename_group_request import RenameGroupRequest as RenameGroupRequest +from flat_api.models.resource_collaborator import ResourceCollaborator as ResourceCollaborator +from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation as ResourceCollaboratorCreation +from flat_api.models.resource_rights import ResourceRights as ResourceRights +from flat_api.models.score_comment import ScoreComment as ScoreComment +from flat_api.models.score_comment_context import ScoreCommentContext as ScoreCommentContext +from flat_api.models.score_comment_creation import ScoreCommentCreation as ScoreCommentCreation +from flat_api.models.score_comment_moderation import ScoreCommentModeration as ScoreCommentModeration +from flat_api.models.score_comment_update import ScoreCommentUpdate as ScoreCommentUpdate +from flat_api.models.score_comments_counts import ScoreCommentsCounts as ScoreCommentsCounts +from flat_api.models.score_creation import ScoreCreation as ScoreCreation +from flat_api.models.score_creation_builder_data import ScoreCreationBuilderData as ScoreCreationBuilderData +from flat_api.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData as ScoreCreationBuilderDataAllOfBuilderData +from flat_api.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData as ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData as ScoreCreationBuilderDataAllOfBuilderDataScoreData +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments as ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from flat_api.models.score_creation_common import ScoreCreationCommon as ScoreCreationCommon +from flat_api.models.score_creation_file_import import ScoreCreationFileImport as ScoreCreationFileImport +from flat_api.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport as ScoreCreationGoogleDriveImport +from flat_api.models.score_creation_type import ScoreCreationType as ScoreCreationType +from flat_api.models.score_details import ScoreDetails as ScoreDetails +from flat_api.models.score_details_all_of_me import ScoreDetailsAllOfMe as ScoreDetailsAllOfMe +from flat_api.models.score_fork import ScoreFork as ScoreFork +from flat_api.models.score_license import ScoreLicense as ScoreLicense +from flat_api.models.score_likes_counts import ScoreLikesCounts as ScoreLikesCounts +from flat_api.models.score_modification import ScoreModification as ScoreModification +from flat_api.models.score_plays_counts import ScorePlaysCounts as ScorePlaysCounts +from flat_api.models.score_privacy import ScorePrivacy as ScorePrivacy +from flat_api.models.score_revision import ScoreRevision as ScoreRevision +from flat_api.models.score_revision_creation import ScoreRevisionCreation as ScoreRevisionCreation +from flat_api.models.score_revision_statistics import ScoreRevisionStatistics as ScoreRevisionStatistics +from flat_api.models.score_source import ScoreSource as ScoreSource +from flat_api.models.score_summary import ScoreSummary as ScoreSummary +from flat_api.models.score_track import ScoreTrack as ScoreTrack +from flat_api.models.score_track_creation import ScoreTrackCreation as ScoreTrackCreation +from flat_api.models.score_track_creation_response import ScoreTrackCreationResponse as ScoreTrackCreationResponse +from flat_api.models.score_track_point import ScoreTrackPoint as ScoreTrackPoint +from flat_api.models.score_track_purpose import ScoreTrackPurpose as ScoreTrackPurpose +from flat_api.models.score_track_state import ScoreTrackState as ScoreTrackState +from flat_api.models.score_track_type import ScoreTrackType as ScoreTrackType +from flat_api.models.score_track_update import ScoreTrackUpdate as ScoreTrackUpdate +from flat_api.models.score_views_counts import ScoreViewsCounts as ScoreViewsCounts +from flat_api.models.task import Task as Task +from flat_api.models.task_export_options import TaskExportOptions as TaskExportOptions +from flat_api.models.task_progress import TaskProgress as TaskProgress +from flat_api.models.task_result import TaskResult as TaskResult +from flat_api.models.teaching_theme import TeachingTheme as TeachingTheme +from flat_api.models.tutteo_product import TutteoProduct as TutteoProduct +from flat_api.models.user_admin_update import UserAdminUpdate as UserAdminUpdate +from flat_api.models.user_azure_details import UserAzureDetails as UserAzureDetails +from flat_api.models.user_basics import UserBasics as UserBasics +from flat_api.models.user_community_profile_links import UserCommunityProfileLinks as UserCommunityProfileLinks +from flat_api.models.user_creation import UserCreation as UserCreation +from flat_api.models.user_details import UserDetails as UserDetails +from flat_api.models.user_details_admin import UserDetailsAdmin as UserDetailsAdmin +from flat_api.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense as UserDetailsAdminAllOfLicense +from flat_api.models.user_public import UserPublic as UserPublic +from flat_api.models.user_public_summary import UserPublicSummary as UserPublicSummary +from flat_api.models.user_signin_link import UserSigninLink as UserSigninLink +from flat_api.models.user_signin_link_creation import UserSigninLinkCreation as UserSigninLinkCreation + diff --git a/flat_api/_retry.py b/flat_api/_retry.py new file mode 100644 index 0000000..eb59cf5 --- /dev/null +++ b/flat_api/_retry.py @@ -0,0 +1,67 @@ +"""Retry policy for the Flat API. + +Flat does not follow the usual conventions, and getting this wrong is silent: + + * rate limiting returns **403**, not 429 + * there is **no Retry-After header**; the reset time is ``X-RateLimit-Reset``, UTC epoch seconds + * a plain 403 is a genuine authorization failure and must never be retried + +So the policy keys on the response body's ``code``, not on the status alone. +""" + +from __future__ import annotations + +import random +import time +from dataclasses import dataclass + +from flat_api.errors import FlatError, FlatRateLimitError, FlatServerError + +#: Methods safe to replay. A non-idempotent request that may already have been applied is not. +IDEMPOTENT_METHODS = frozenset({"GET", "HEAD", "OPTIONS", "PUT", "DELETE"}) + +MAX_RATE_LIMIT_WAIT = 300.0 + + +@dataclass(frozen=True) +class RetryPolicy: + """How the client retries. Pass ``RetryPolicy.disabled()`` to opt out entirely.""" + + attempts: int = 3 + backoff_base: float = 0.5 + backoff_max: float = 30.0 + jitter: float = 0.25 + respect_rate_limit_reset: bool = True + + @classmethod + def disabled(cls) -> "RetryPolicy": + """No retries. Errors still arrive typed, and a rate-limit error still carries its reset.""" + return cls(attempts=1) + + @property + def enabled(self) -> bool: + return self.attempts > 1 + + def should_retry(self, error: BaseException, method: str, attempt: int) -> bool: + if attempt >= self.attempts: + return False + if method.upper() not in IDEMPOTENT_METHODS: + return False + if isinstance(error, FlatRateLimitError): + return True + if isinstance(error, FlatServerError): + return True + # A transport failure before the request was sent is safe to replay. + return isinstance(error, OSError) and not isinstance(error, FlatError) + + def delay_for(self, error: BaseException, attempt: int) -> float: + if ( + self.respect_rate_limit_reset + and isinstance(error, FlatRateLimitError) + and error.reset is not None + ): + wait = error.reset - time.time() + if wait > 0: + return min(wait + random.uniform(0, self.jitter), MAX_RATE_LIMIT_WAIT) + exponential = min(self.backoff_base * (2 ** (attempt - 1)), self.backoff_max) + return exponential + random.uniform(0, self.jitter * exponential) diff --git a/flat_api/aio/__init__.py b/flat_api/aio/__init__.py new file mode 100644 index 0000000..72f5acd --- /dev/null +++ b/flat_api/aio/__init__.py @@ -0,0 +1,459 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "2.0.0" + +# Define package exports +__all__ = [ + "AccountApi", + "ClassApi", + "CollectionApi", + "EduResourcesApi", + "GroupApi", + "OMRApi", + "OrganizationApi", + "ScoreApi", + "TaskApi", + "UserApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "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", + "OmrCapabilities", + "OmrDetailsStepData", + "OmrDetailsSubmission", + "OmrDetectedInstrument", + "OmrImportedMetadata", + "OmrInstrumentOverride", + "OmrJob", + "OmrJobCreation", + "OmrJobFileMetadata", + "OmrJobFileUpload", + "OmrJobFileUploadResult", + "OmrJobInputFile", + "OmrJobOutput", + "OmrJobProgress", + "OmrJobResult", + "OmrJobRetention", + "OmrJobStatus", + "OmrLocaleDetails", + "OmrPendingStep", + "OmrStepName", + "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", +] + +# import apis into sdk package +from flat_api.aio.api.account_api import AccountApi as AccountApi +from flat_api.aio.api.class_api import ClassApi as ClassApi +from flat_api.aio.api.collection_api import CollectionApi as CollectionApi +from flat_api.aio.api.edu_resources_api import EduResourcesApi as EduResourcesApi +from flat_api.aio.api.group_api import GroupApi as GroupApi +from flat_api.aio.api.omr_api import OMRApi as OMRApi +from flat_api.aio.api.organization_api import OrganizationApi as OrganizationApi +from flat_api.aio.api.score_api import ScoreApi as ScoreApi +from flat_api.aio.api.task_api import TaskApi as TaskApi +from flat_api.aio.api.user_api import UserApi as UserApi + +# import ApiClient +from flat_api.aio.api_response import ApiResponse as ApiResponse +from flat_api.aio.api_client import ApiClient as ApiClient +from flat_api.aio.configuration import Configuration as Configuration +from flat_api.aio.exceptions import OpenApiException as OpenApiException +from flat_api.aio.exceptions import ApiTypeError as ApiTypeError +from flat_api.aio.exceptions import ApiValueError as ApiValueError +from flat_api.aio.exceptions import ApiKeyError as ApiKeyError +from flat_api.aio.exceptions import ApiAttributeError as ApiAttributeError +from flat_api.aio.exceptions import ApiException as ApiException + +# import models into sdk package +from flat_api.aio.models.add_group_user200_response import AddGroupUser200Response as AddGroupUser200Response +from flat_api.aio.models.add_group_user_request import AddGroupUserRequest as AddGroupUserRequest +from flat_api.aio.models.api_access_token import ApiAccessToken as ApiAccessToken +from flat_api.aio.models.app_scopes import AppScopes as AppScopes +from flat_api.aio.models.assignment import Assignment as Assignment +from flat_api.aio.models.assignment_capabilities import AssignmentCapabilities as AssignmentCapabilities +from flat_api.aio.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError as AssignmentCapabilitiesCanPublishInClassError +from flat_api.aio.models.assignment_copy import AssignmentCopy as AssignmentCopy +from flat_api.aio.models.assignment_copy_response import AssignmentCopyResponse as AssignmentCopyResponse +from flat_api.aio.models.assignment_copy_to_class import AssignmentCopyToClass as AssignmentCopyToClass +from flat_api.aio.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary as AssignmentCopyToResourceLibrary +from flat_api.aio.models.assignment_group import AssignmentGroup as AssignmentGroup +from flat_api.aio.models.assignment_submission import AssignmentSubmission as AssignmentSubmission +from flat_api.aio.models.assignment_submission_comment import AssignmentSubmissionComment as AssignmentSubmissionComment +from flat_api.aio.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation as AssignmentSubmissionCommentCreation +from flat_api.aio.models.assignment_submission_comments import AssignmentSubmissionComments as AssignmentSubmissionComments +from flat_api.aio.models.assignment_submission_history import AssignmentSubmissionHistory as AssignmentSubmissionHistory +from flat_api.aio.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment as AssignmentSubmissionHistoryAttachment +from flat_api.aio.models.assignment_submission_history_state import AssignmentSubmissionHistoryState as AssignmentSubmissionHistoryState +from flat_api.aio.models.assignment_submission_lti import AssignmentSubmissionLti as AssignmentSubmissionLti +from flat_api.aio.models.assignment_submission_playback import AssignmentSubmissionPlayback as AssignmentSubmissionPlayback +from flat_api.aio.models.assignment_submission_state import AssignmentSubmissionState as AssignmentSubmissionState +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode as AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_submission_update import AssignmentSubmissionUpdate as AssignmentSubmissionUpdate +from flat_api.aio.models.assignment_type import AssignmentType as AssignmentType +from flat_api.aio.models.assignment_update import AssignmentUpdate as AssignmentUpdate +from flat_api.aio.models.class_assignment import ClassAssignment as ClassAssignment +from flat_api.aio.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas as ClassAssignmentAllOfCanvas +from flat_api.aio.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti as ClassAssignmentAllOfLti +from flat_api.aio.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc as ClassAssignmentAllOfMfc +from flat_api.aio.models.class_assignment_update import ClassAssignmentUpdate as ClassAssignmentUpdate +from flat_api.aio.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom as ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.aio.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph as ClassAssignmentUpdateAllOfMicrosoftGraph +from flat_api.aio.models.class_attachment_creation import ClassAttachmentCreation as ClassAttachmentCreation +from flat_api.aio.models.class_creation import ClassCreation as ClassCreation +from flat_api.aio.models.class_details import ClassDetails as ClassDetails +from flat_api.aio.models.class_details_canvas import ClassDetailsCanvas as ClassDetailsCanvas +from flat_api.aio.models.class_details_clever import ClassDetailsClever as ClassDetailsClever +from flat_api.aio.models.class_details_google_classroom import ClassDetailsGoogleClassroom as ClassDetailsGoogleClassroom +from flat_api.aio.models.class_details_google_drive import ClassDetailsGoogleDrive as ClassDetailsGoogleDrive +from flat_api.aio.models.class_details_issues import ClassDetailsIssues as ClassDetailsIssues +from flat_api.aio.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner as ClassDetailsIssuesSyncInner +from flat_api.aio.models.class_details_lti import ClassDetailsLti as ClassDetailsLti +from flat_api.aio.models.class_details_mfc import ClassDetailsMfc as ClassDetailsMfc +from flat_api.aio.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph as ClassDetailsMicrosoftGraph +from flat_api.aio.models.class_grade_level import ClassGradeLevel as ClassGradeLevel +from flat_api.aio.models.class_roles import ClassRoles as ClassRoles +from flat_api.aio.models.class_state import ClassState as ClassState +from flat_api.aio.models.class_update import ClassUpdate as ClassUpdate +from flat_api.aio.models.collection import Collection as Collection +from flat_api.aio.models.collection_app import CollectionApp as CollectionApp +from flat_api.aio.models.collection_capabilities import CollectionCapabilities as CollectionCapabilities +from flat_api.aio.models.collection_contents import CollectionContents as CollectionContents +from flat_api.aio.models.collection_creation import CollectionCreation as CollectionCreation +from flat_api.aio.models.collection_modification import CollectionModification as CollectionModification +from flat_api.aio.models.collection_privacy import CollectionPrivacy as CollectionPrivacy +from flat_api.aio.models.collection_type import CollectionType as CollectionType +from flat_api.aio.models.credit_transaction import CreditTransaction as CreditTransaction +from flat_api.aio.models.edu_library import EduLibrary as EduLibrary +from flat_api.aio.models.edu_resource import EduResource as EduResource +from flat_api.aio.models.edu_resource_assignment_creation import EduResourceAssignmentCreation as EduResourceAssignmentCreation +from flat_api.aio.models.edu_resource_capabilities import EduResourceCapabilities as EduResourceCapabilities +from flat_api.aio.models.edu_resource_copy import EduResourceCopy as EduResourceCopy +from flat_api.aio.models.edu_resource_creation import EduResourceCreation as EduResourceCreation +from flat_api.aio.models.edu_resource_folder import EduResourceFolder as EduResourceFolder +from flat_api.aio.models.edu_resource_lti_link import EduResourceLtiLink as EduResourceLtiLink +from flat_api.aio.models.edu_resource_move import EduResourceMove as EduResourceMove +from flat_api.aio.models.edu_resource_privacy import EduResourcePrivacy as EduResourcePrivacy +from flat_api.aio.models.edu_resource_resource import EduResourceResource as EduResourceResource +from flat_api.aio.models.edu_resource_type import EduResourceType as EduResourceType +from flat_api.aio.models.edu_resource_update import EduResourceUpdate as EduResourceUpdate +from flat_api.aio.models.edu_resource_use_in_class import EduResourceUseInClass as EduResourceUseInClass +from flat_api.aio.models.flat_error_response import FlatErrorResponse as FlatErrorResponse +from flat_api.aio.models.google_classroom_coursework import GoogleClassroomCoursework as GoogleClassroomCoursework +from flat_api.aio.models.google_classroom_submission import GoogleClassroomSubmission as GoogleClassroomSubmission +from flat_api.aio.models.grade import Grade as Grade +from flat_api.aio.models.group import Group as Group +from flat_api.aio.models.group_creation import GroupCreation as GroupCreation +from flat_api.aio.models.group_details import GroupDetails as GroupDetails +from flat_api.aio.models.group_type import GroupType as GroupType +from flat_api.aio.models.license_mode import LicenseMode as LicenseMode +from flat_api.aio.models.license_sources import LicenseSources as LicenseSources +from flat_api.aio.models.lms_name import LmsName as LmsName +from flat_api.aio.models.lti_configuration import LtiConfiguration as LtiConfiguration +from flat_api.aio.models.lti_configuration1p1 import LtiConfiguration1p1 as LtiConfiguration1p1 +from flat_api.aio.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool as LtiConfiguration1p1AllOfTool +from flat_api.aio.models.lti_configuration1p3 import LtiConfiguration1p3 as LtiConfiguration1p3 +from flat_api.aio.models.lti_configuration1p3_base import LtiConfiguration1p3Base as LtiConfiguration1p3Base +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices as LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs as LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.aio.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking as LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.aio.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps as LtiConfiguration1p3BaseSupportedServicesNrps +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool as LtiConfiguration1p3BaseTool +from flat_api.aio.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment as LtiConfiguration1p3Deployment +from flat_api.aio.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic as LtiConfiguration1p3Dynamic +from flat_api.aio.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual as LtiConfiguration1p3Manual +from flat_api.aio.models.lti_configuration_base import LtiConfigurationBase as LtiConfigurationBase +from flat_api.aio.models.lti_configuration_create import LtiConfigurationCreate as LtiConfigurationCreate +from flat_api.aio.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 as LtiConfigurationCreate1p1 +from flat_api.aio.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment as LtiConfigurationCreate1p3Deployment +from flat_api.aio.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic as LtiConfigurationCreate1p3Dynamic +from flat_api.aio.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo as LtiConfigurationCreate1p3DynamicPlatformInfo +from flat_api.aio.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual as LtiConfigurationCreate1p3Manual +from flat_api.aio.models.lti_configuration_update import LtiConfigurationUpdate as LtiConfigurationUpdate +from flat_api.aio.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment as LtiConfigurationUpdateDeployment +from flat_api.aio.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone as LtiConfigurationUpdateStandalone +from flat_api.aio.models.lti_credentials import LtiCredentials as LtiCredentials +from flat_api.aio.models.lti_credentials_creation import LtiCredentialsCreation as LtiCredentialsCreation +from flat_api.aio.models.media_attachment import MediaAttachment as MediaAttachment +from flat_api.aio.models.media_score_sharing_mode import MediaScoreSharingMode as MediaScoreSharingMode +from flat_api.aio.models.microsoft_graph_assignment import MicrosoftGraphAssignment as MicrosoftGraphAssignment +from flat_api.aio.models.microsoft_graph_submission import MicrosoftGraphSubmission as MicrosoftGraphSubmission +from flat_api.aio.models.omr_capabilities import OmrCapabilities as OmrCapabilities +from flat_api.aio.models.omr_details_step_data import OmrDetailsStepData as OmrDetailsStepData +from flat_api.aio.models.omr_details_submission import OmrDetailsSubmission as OmrDetailsSubmission +from flat_api.aio.models.omr_detected_instrument import OmrDetectedInstrument as OmrDetectedInstrument +from flat_api.aio.models.omr_imported_metadata import OmrImportedMetadata as OmrImportedMetadata +from flat_api.aio.models.omr_instrument_override import OmrInstrumentOverride as OmrInstrumentOverride +from flat_api.aio.models.omr_job import OmrJob as OmrJob +from flat_api.aio.models.omr_job_creation import OmrJobCreation as OmrJobCreation +from flat_api.aio.models.omr_job_file_metadata import OmrJobFileMetadata as OmrJobFileMetadata +from flat_api.aio.models.omr_job_file_upload import OmrJobFileUpload as OmrJobFileUpload +from flat_api.aio.models.omr_job_file_upload_result import OmrJobFileUploadResult as OmrJobFileUploadResult +from flat_api.aio.models.omr_job_input_file import OmrJobInputFile as OmrJobInputFile +from flat_api.aio.models.omr_job_output import OmrJobOutput as OmrJobOutput +from flat_api.aio.models.omr_job_progress import OmrJobProgress as OmrJobProgress +from flat_api.aio.models.omr_job_result import OmrJobResult as OmrJobResult +from flat_api.aio.models.omr_job_retention import OmrJobRetention as OmrJobRetention +from flat_api.aio.models.omr_job_status import OmrJobStatus as OmrJobStatus +from flat_api.aio.models.omr_locale_details import OmrLocaleDetails as OmrLocaleDetails +from flat_api.aio.models.omr_pending_step import OmrPendingStep as OmrPendingStep +from flat_api.aio.models.omr_step_name import OmrStepName as OmrStepName +from flat_api.aio.models.organization_invitation import OrganizationInvitation as OrganizationInvitation +from flat_api.aio.models.organization_invitation_creation import OrganizationInvitationCreation as OrganizationInvitationCreation +from flat_api.aio.models.organization_roles import OrganizationRoles as OrganizationRoles +from flat_api.aio.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation as OrganizationUserAccessTokenCreation +from flat_api.aio.models.rename_group_request import RenameGroupRequest as RenameGroupRequest +from flat_api.aio.models.resource_collaborator import ResourceCollaborator as ResourceCollaborator +from flat_api.aio.models.resource_collaborator_creation import ResourceCollaboratorCreation as ResourceCollaboratorCreation +from flat_api.aio.models.resource_rights import ResourceRights as ResourceRights +from flat_api.aio.models.score_comment import ScoreComment as ScoreComment +from flat_api.aio.models.score_comment_context import ScoreCommentContext as ScoreCommentContext +from flat_api.aio.models.score_comment_creation import ScoreCommentCreation as ScoreCommentCreation +from flat_api.aio.models.score_comment_moderation import ScoreCommentModeration as ScoreCommentModeration +from flat_api.aio.models.score_comment_update import ScoreCommentUpdate as ScoreCommentUpdate +from flat_api.aio.models.score_comments_counts import ScoreCommentsCounts as ScoreCommentsCounts +from flat_api.aio.models.score_creation import ScoreCreation as ScoreCreation +from flat_api.aio.models.score_creation_builder_data import ScoreCreationBuilderData as ScoreCreationBuilderData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData as ScoreCreationBuilderDataAllOfBuilderData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData as ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData as ScoreCreationBuilderDataAllOfBuilderDataScoreData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments as ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from flat_api.aio.models.score_creation_common import ScoreCreationCommon as ScoreCreationCommon +from flat_api.aio.models.score_creation_file_import import ScoreCreationFileImport as ScoreCreationFileImport +from flat_api.aio.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport as ScoreCreationGoogleDriveImport +from flat_api.aio.models.score_creation_type import ScoreCreationType as ScoreCreationType +from flat_api.aio.models.score_details import ScoreDetails as ScoreDetails +from flat_api.aio.models.score_details_all_of_me import ScoreDetailsAllOfMe as ScoreDetailsAllOfMe +from flat_api.aio.models.score_fork import ScoreFork as ScoreFork +from flat_api.aio.models.score_license import ScoreLicense as ScoreLicense +from flat_api.aio.models.score_likes_counts import ScoreLikesCounts as ScoreLikesCounts +from flat_api.aio.models.score_modification import ScoreModification as ScoreModification +from flat_api.aio.models.score_plays_counts import ScorePlaysCounts as ScorePlaysCounts +from flat_api.aio.models.score_privacy import ScorePrivacy as ScorePrivacy +from flat_api.aio.models.score_revision import ScoreRevision as ScoreRevision +from flat_api.aio.models.score_revision_creation import ScoreRevisionCreation as ScoreRevisionCreation +from flat_api.aio.models.score_revision_statistics import ScoreRevisionStatistics as ScoreRevisionStatistics +from flat_api.aio.models.score_source import ScoreSource as ScoreSource +from flat_api.aio.models.score_summary import ScoreSummary as ScoreSummary +from flat_api.aio.models.score_track import ScoreTrack as ScoreTrack +from flat_api.aio.models.score_track_creation import ScoreTrackCreation as ScoreTrackCreation +from flat_api.aio.models.score_track_creation_response import ScoreTrackCreationResponse as ScoreTrackCreationResponse +from flat_api.aio.models.score_track_point import ScoreTrackPoint as ScoreTrackPoint +from flat_api.aio.models.score_track_purpose import ScoreTrackPurpose as ScoreTrackPurpose +from flat_api.aio.models.score_track_state import ScoreTrackState as ScoreTrackState +from flat_api.aio.models.score_track_type import ScoreTrackType as ScoreTrackType +from flat_api.aio.models.score_track_update import ScoreTrackUpdate as ScoreTrackUpdate +from flat_api.aio.models.score_views_counts import ScoreViewsCounts as ScoreViewsCounts +from flat_api.aio.models.task import Task as Task +from flat_api.aio.models.task_export_options import TaskExportOptions as TaskExportOptions +from flat_api.aio.models.task_progress import TaskProgress as TaskProgress +from flat_api.aio.models.task_result import TaskResult as TaskResult +from flat_api.aio.models.teaching_theme import TeachingTheme as TeachingTheme +from flat_api.aio.models.tutteo_product import TutteoProduct as TutteoProduct +from flat_api.aio.models.user_admin_update import UserAdminUpdate as UserAdminUpdate +from flat_api.aio.models.user_azure_details import UserAzureDetails as UserAzureDetails +from flat_api.aio.models.user_basics import UserBasics as UserBasics +from flat_api.aio.models.user_community_profile_links import UserCommunityProfileLinks as UserCommunityProfileLinks +from flat_api.aio.models.user_creation import UserCreation as UserCreation +from flat_api.aio.models.user_details import UserDetails as UserDetails +from flat_api.aio.models.user_details_admin import UserDetailsAdmin as UserDetailsAdmin +from flat_api.aio.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense as UserDetailsAdminAllOfLicense +from flat_api.aio.models.user_public import UserPublic as UserPublic +from flat_api.aio.models.user_public_summary import UserPublicSummary as UserPublicSummary +from flat_api.aio.models.user_signin_link import UserSigninLink as UserSigninLink +from flat_api.aio.models.user_signin_link_creation import UserSigninLinkCreation as UserSigninLinkCreation + diff --git a/flat_api/aio/api/__init__.py b/flat_api/aio/api/__init__.py new file mode 100644 index 0000000..de44471 --- /dev/null +++ b/flat_api/aio/api/__init__.py @@ -0,0 +1,14 @@ +# flake8: noqa + +# import apis into api package +from flat_api.aio.api.account_api import AccountApi +from flat_api.aio.api.class_api import ClassApi +from flat_api.aio.api.collection_api import CollectionApi +from flat_api.aio.api.edu_resources_api import EduResourcesApi +from flat_api.aio.api.group_api import GroupApi +from flat_api.aio.api.omr_api import OMRApi +from flat_api.aio.api.organization_api import OrganizationApi +from flat_api.aio.api.score_api import ScoreApi +from flat_api.aio.api.task_api import TaskApi +from flat_api.aio.api.user_api import UserApi + diff --git a/flat_api/aio/api/account_api.py b/flat_api/aio/api/account_api.py new file mode 100644 index 0000000..78240ab --- /dev/null +++ b/flat_api/aio/api/account_api.py @@ -0,0 +1,305 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool +from typing import Optional +from typing_extensions import Annotated +from flat_api.aio.models.user_details import UserDetails + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class AccountApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def get_authenticated_user( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetails: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_authenticated_user_with_http_info( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetails]: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_authenticated_user_without_preload_content( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_authenticated_user_serialize( + self, + only_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if only_id is not None: + + _query_params.append(('onlyId', only_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/me', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/class_api.py b/flat_api/aio/api/class_api.py new file mode 100644 index 0000000..a6473cd --- /dev/null +++ b/flat_api/aio/api/class_api.py @@ -0,0 +1,9485 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.aio.models.assignment import Assignment +from flat_api.aio.models.assignment_copy import AssignmentCopy +from flat_api.aio.models.assignment_copy_response import AssignmentCopyResponse +from flat_api.aio.models.assignment_submission import AssignmentSubmission +from flat_api.aio.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.aio.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.aio.models.assignment_submission_history import AssignmentSubmissionHistory +from flat_api.aio.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.aio.models.class_assignment import ClassAssignment +from flat_api.aio.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.aio.models.class_creation import ClassCreation +from flat_api.aio.models.class_details import ClassDetails +from flat_api.aio.models.class_update import ClassUpdate +from flat_api.aio.models.user_details import UserDetails + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class ClassApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def activate_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def activate_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def activate_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _activate_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/activate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def add_class_user( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_class_user_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_class_user_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_class_user_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def archive_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def archive_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def archive_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _archive_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def archive_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def archive_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def archive_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _archive_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def copy_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def copy_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def copy_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_assignment_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/copy', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_class( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_class_with_http_info( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_class_without_preload_content( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_class_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_class_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_class_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_class_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_class_assignment_serialize( + self, + var_class, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_submission_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_test_student_account( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetails: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_test_student_account_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetails]: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_test_student_account_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_test_student_account_serialize( + self, + var_class, + reset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + if reset is not None: + + _query_params.append(('reset', reset)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/testStudent', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_class_user( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_class_user_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_class_user_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_class_user_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_submission_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_submission_comment_serialize( + self, + var_class, + assignment, + submission, + comment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def edit_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def edit_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def edit_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_submission_serialize( + self, + var_class, + assignment, + submission, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def enroll_class( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def enroll_class_with_http_info( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def enroll_class_without_preload_content( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enroll_class_serialize( + self, + enrollment_code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if enrollment_code is not None: + _path_params['enrollmentCode'] = enrollment_code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/enroll/{enrollmentCode}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def export_submissions_reviews_as_csv( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def export_submissions_reviews_as_csv_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def export_submissions_reviews_as_csv_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_submissions_reviews_as_csv_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/csv' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/csv', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def export_submissions_reviews_as_excel( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def export_submissions_reviews_as_excel_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def export_submissions_reviews_as_excel_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_submissions_reviews_as_excel_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/excel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_submissions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_submissions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_submissions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_submissions_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_submission_comments( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmissionComment]: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_submission_comments_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmissionComment]]: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_submission_comments_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_comments_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_submission_history( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmissionHistory]: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_submission_history_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmissionHistory]]: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_submission_history_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_history_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/history', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_submissions( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmission]: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_submissions_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmission]]: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_submissions_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submissions_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_assignments( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ClassAssignment]: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_assignments_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ClassAssignment]]: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_assignments_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_assignments_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_class_student_submissions( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_class_student_submissions_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_class_student_submissions_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_class_student_submissions_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/students/{user}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_classes( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ClassDetails]: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_classes_with_http_info( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ClassDetails]]: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_classes_without_preload_content( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_classes_serialize( + self, + state, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if state is not None: + + _query_params.append(('state', state)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def post_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmissionComment: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def post_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmissionComment]: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def post_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_submission_comment_serialize( + self, + var_class, + assignment, + submission, + assignment_submission_comment_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_submission_comment_creation is not None: + _body_params = assignment_submission_comment_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def unarchive_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def unarchive_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def unarchive_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _unarchive_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def unarchive_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def unarchive_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def unarchive_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _unarchive_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_class_serialize( + self, + var_class, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_class_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_class_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_class_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_class_assignment_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmissionComment: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmissionComment]: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_submission_comment_serialize( + self, + var_class, + assignment, + submission, + comment, + assignment_submission_comment_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_submission_comment_creation is not None: + _body_params = assignment_submission_comment_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/collection_api.py b/flat_api/aio/api/collection_api.py new file mode 100644 index 0000000..ff7b692 --- /dev/null +++ b/flat_api/aio/api/collection_api.py @@ -0,0 +1,2803 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.collection import Collection +from flat_api.aio.models.collection_creation import CollectionCreation +from flat_api.aio.models.collection_modification import CollectionModification +from flat_api.aio.models.flat_error_response import FlatErrorResponse +from flat_api.aio.models.score_details import ScoreDetails + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class CollectionApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def add_score_to_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_score_to_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_score_to_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_to_collection_serialize( + self, + collection, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/collections/{collection}/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_collection( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_collection_with_http_info( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_collection_without_preload_content( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_collection_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_collection( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_collection_serialize( + self, + collection, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_score_from_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_score_from_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_score_from_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_from_collection_serialize( + self, + collection, + score, + event_properties, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + if score is not None: + _path_params['score'] = score + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/collections/{collection}/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def edit_collection( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def edit_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def edit_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_collection_serialize( + self, + collection, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_collection_serialize( + self, + collection, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_collection_scores( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_collection_scores_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_collection_scores_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_collection_scores_serialize( + self, + collection, + sort, + direction, + limit, + next, + previous, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections/{collection}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_collections( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_collections_with_http_info( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_collections_without_preload_content( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_collections_serialize( + self, + parent, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def untrash_collection( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FlatErrorResponse: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def untrash_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FlatErrorResponse]: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def untrash_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _untrash_collection_serialize( + self, + collection, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/collections/{collection}/untrash', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/edu_resources_api.py b/flat_api/aio/api/edu_resources_api.py new file mode 100644 index 0000000..eed1dcc --- /dev/null +++ b/flat_api/aio/api/edu_resources_api.py @@ -0,0 +1,3509 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.assignment import Assignment +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.assignment_update import AssignmentUpdate +from flat_api.aio.models.class_assignment import ClassAssignment +from flat_api.aio.models.edu_library import EduLibrary +from flat_api.aio.models.edu_resource import EduResource +from flat_api.aio.models.edu_resource_copy import EduResourceCopy +from flat_api.aio.models.edu_resource_creation import EduResourceCreation +from flat_api.aio.models.edu_resource_lti_link import EduResourceLtiLink +from flat_api.aio.models.edu_resource_move import EduResourceMove +from flat_api.aio.models.edu_resource_update import EduResourceUpdate +from flat_api.aio.models.edu_resource_use_in_class import EduResourceUseInClass +from flat_api.aio.models.grade import Grade +from flat_api.aio.models.teaching_theme import TeachingTheme + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class EduResourcesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def copy_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def copy_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def copy_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_edu_resource_serialize( + self, + resource, + edu_resource_copy, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_copy is not None: + _body_params = edu_resource_copy + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/copy', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def copy_edu_resource_to_demo_class( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def copy_edu_resource_to_demo_class_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def copy_edu_resource_to_demo_class_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_edu_resource_to_demo_class_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/copyToDemoClass', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_edu_resource( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_edu_resource_with_http_info( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_edu_resource_without_preload_content( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_edu_resource_serialize( + self, + edu_resource_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_creation is not None: + _body_params = edu_resource_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_edu_resource_lti_link( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_edu_resource_lti_link_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_edu_resource_lti_link_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_edu_resource_lti_link_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/createLtiLink', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_edu_resource_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_edu_resource_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_edu_libraries( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[EduLibrary]: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_edu_libraries_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[EduLibrary]]: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_edu_libraries_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_edu_libraries_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources/libraries', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_edu_resources( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[EduResource]: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_edu_resources_with_http_info( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[EduResource]]: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_edu_resources_without_preload_content( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_edu_resources_serialize( + self, + parent, + without_subfolders_resources, + type, + subjects, + assignment_types, + grades, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'subjects': 'multi', + 'assignmentTypes': 'multi', + 'grades': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + if without_subfolders_resources is not None: + + _query_params.append(('withoutSubfoldersResources', without_subfolders_resources)) + + if type is not None: + + _query_params.append(('type', type)) + + if subjects is not None: + + _query_params.append(('subjects', subjects)) + + if assignment_types is not None: + + _query_params.append(('assignmentTypes', assignment_types)) + + if grades is not None: + + _query_params.append(('grades', grades)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def move_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def move_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def move_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _move_edu_resource_serialize( + self, + resource, + edu_resource_move, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_move is not None: + _body_params = edu_resource_move + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/move', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_edu_resource_serialize( + self, + resource, + edu_resource_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_update is not None: + _body_params = edu_resource_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_edu_resource_assignment( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_edu_resource_assignment_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_edu_resource_assignment_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_edu_resource_assignment_serialize( + self, + resource, + assignment_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_update is not None: + _body_params = assignment_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/eduResources/{resource}/assignment', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def use_edu_resource_in_class( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def use_edu_resource_in_class_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def use_edu_resource_in_class_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _use_edu_resource_in_class_serialize( + self, + resource, + edu_resource_use_in_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_use_in_class is not None: + _body_params = edu_resource_use_in_class + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/useInClass', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/group_api.py b/flat_api/aio/api/group_api.py new file mode 100644 index 0000000..d7d8dd3 --- /dev/null +++ b/flat_api/aio/api/group_api.py @@ -0,0 +1,2629 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.add_group_user200_response import AddGroupUser200Response +from flat_api.aio.models.add_group_user_request import AddGroupUserRequest +from flat_api.aio.models.group_creation import GroupCreation +from flat_api.aio.models.group_details import GroupDetails +from flat_api.aio.models.rename_group_request import RenameGroupRequest +from flat_api.aio.models.score_details import ScoreDetails +from flat_api.aio.models.user_public import UserPublic + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class GroupApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def add_group_user( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AddGroupUser200Response: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_group_user_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AddGroupUser200Response]: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_group_user_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_group_user_serialize( + self, + group, + add_group_user_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if add_group_user_request is not None: + _body_params = add_group_user_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/groups/{group}/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_group( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_group_with_http_info( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_group_without_preload_content( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_group_serialize( + self, + group_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if group_creation is not None: + _body_params = group_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/groups', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_group( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_group_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_group_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_group_serialize( + self, + group, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_group_details( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_group_details_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_group_details_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_details_serialize( + self, + group, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_group_scores( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_group_scores_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_group_scores_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_scores_serialize( + self, + group, + parent, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_group_users( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserPublic]: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_group_users_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserPublic]]: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_group_users_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_group_users_serialize( + self, + group, + source, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if source is not None: + + _query_params.append(('source', source)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_groups( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[GroupDetails]: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_groups_with_http_info( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[GroupDetails]]: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_groups_without_preload_content( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_groups_serialize( + self, + type, + classroom, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + if classroom is not None: + + _query_params.append(('classroom', classroom)) + + if assignment is not None: + + _query_params.append(('assignment', assignment)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def remove_group_user( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def remove_group_user_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def remove_group_user_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_group_user_serialize( + self, + group, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/groups/{group}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def rename_group( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def rename_group_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def rename_group_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _rename_group_serialize( + self, + group, + rename_group_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rename_group_request is not None: + _body_params = rename_group_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/omr_api.py b/flat_api/aio/api/omr_api.py new file mode 100644 index 0000000..bafbee1 --- /dev/null +++ b/flat_api/aio/api/omr_api.py @@ -0,0 +1,3646 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.aio.models.credit_transaction import CreditTransaction +from flat_api.aio.models.omr_capabilities import OmrCapabilities +from flat_api.aio.models.omr_details_submission import OmrDetailsSubmission +from flat_api.aio.models.omr_job import OmrJob +from flat_api.aio.models.omr_job_creation import OmrJobCreation +from flat_api.aio.models.omr_job_file_upload import OmrJobFileUpload +from flat_api.aio.models.omr_job_file_upload_result import OmrJobFileUploadResult +from flat_api.aio.models.omr_job_status import OmrJobStatus +from flat_api.aio.models.omr_step_name import OmrStepName + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class OMRApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def add_omr_job_file( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_omr_job_file_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_omr_job_file_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_omr_job_file_serialize( + self, + job, + omr_job_file_upload, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if omr_job_file_upload is not None: + _body_params = omr_job_file_upload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/files', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def cancel_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OmrJob: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def cancel_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OmrJob]: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def cancel_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _cancel_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/cancel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_omr_job( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_omr_job_with_http_info( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_omr_job_without_preload_content( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_omr_job_serialize( + self, + omr_job_creation, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if omr_job_creation is not None: + _body_params = omr_job_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/omr/jobs/{job}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_omr_capabilities( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_omr_capabilities_with_http_info( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_omr_capabilities_without_preload_content( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_capabilities_serialize( + self, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/capabilities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_serialize( + self, + job, + wait, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + if wait is not None: + + _query_params.append(('wait', wait)) + + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_omr_job_export( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_omr_job_export_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_omr_job_export_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_export_serialize( + self, + job, + format, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if format is not None: + _path_params['format'] = format + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/octet-stream', + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}/exports/{format}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_omr_job_file( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_omr_job_file_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_omr_job_file_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_file_serialize( + self, + job, + index, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if index is not None: + _path_params['index'] = index + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'image/jpeg', + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}/files/{index}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_billing_credits_history( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_billing_credits_history_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_billing_credits_history_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_billing_credits_history_serialize( + self, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/billing/credits/history', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_omr_jobs( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[OmrJob]: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_omr_jobs_with_http_info( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[OmrJob]]: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_omr_jobs_without_preload_content( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_omr_jobs_serialize( + self, + status, + expired, + limit, + next, + previous, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if status is not None: + + _query_params.append(('status', status.value)) + + if expired is not None: + + _query_params.append(('expired', expired)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def start_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OmrJob: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def start_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OmrJob]: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def start_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _start_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/start', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def submit_omr_job_step( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def submit_omr_job_step_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def submit_omr_job_step_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _submit_omr_job_step_serialize( + self, + job, + step, + body, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if step is not None: + _path_params['step'] = step.value + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/steps/{step}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/organization_api.py b/flat_api/aio/api/organization_api.py new file mode 100644 index 0000000..0800712 --- /dev/null +++ b/flat_api/aio/api/organization_api.py @@ -0,0 +1,4996 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.api_access_token import ApiAccessToken +from flat_api.aio.models.lti_configuration import LtiConfiguration +from flat_api.aio.models.lti_configuration_create import LtiConfigurationCreate +from flat_api.aio.models.lti_configuration_update import LtiConfigurationUpdate +from flat_api.aio.models.lti_credentials import LtiCredentials +from flat_api.aio.models.lti_credentials_creation import LtiCredentialsCreation +from flat_api.aio.models.organization_invitation import OrganizationInvitation +from flat_api.aio.models.organization_invitation_creation import OrganizationInvitationCreation +from flat_api.aio.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation +from flat_api.aio.models.user_admin_update import UserAdminUpdate +from flat_api.aio.models.user_creation import UserCreation +from flat_api.aio.models.user_details_admin import UserDetailsAdmin +from flat_api.aio.models.user_signin_link import UserSigninLink +from flat_api.aio.models.user_signin_link_creation import UserSigninLinkCreation + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class OrganizationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def count_orga_users( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> int: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def count_orga_users_with_http_info( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[int]: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def count_orga_users_without_preload_content( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _count_orga_users_serialize( + self, + role, + q, + group, + no_active_license, + test_accounts, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'role': 'multi', + 'group': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if role is not None: + + _query_params.append(('role', role)) + + if q is not None: + + _query_params.append(('q', q)) + + if group is not None: + + _query_params.append(('group', group)) + + if no_active_license is not None: + + _query_params.append(('noActiveLicense', no_active_license)) + + if test_accounts is not None: + + _query_params.append(('testAccounts', test_accounts)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/users/count', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_lti_configuration( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiConfiguration: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_lti_configuration_with_http_info( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiConfiguration]: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_lti_configuration_without_preload_content( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_lti_configuration_serialize( + self, + lti_configuration_create, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if lti_configuration_create is not None: + _body_params = lti_configuration_create + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/lti/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_lti_credentials( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiCredentials: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_lti_credentials_with_http_info( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiCredentials]: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_lti_credentials_without_preload_content( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_lti_credentials_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/lti/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_organization_invitation( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrganizationInvitation: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_organization_invitation_with_http_info( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrganizationInvitation]: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_organization_invitation_without_preload_content( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_invitation_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_organization_user( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetailsAdmin: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_organization_user_with_http_info( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetailsAdmin]: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_organization_user_without_preload_content( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_organization_user_access_token( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_organization_user_access_token_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_organization_user_access_token_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_access_token_serialize( + self, + user, + organization_user_access_token_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if organization_user_access_token_creation is not None: + _body_params = organization_user_access_token_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users/{user}/accessToken', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_organization_user_signin_link( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserSigninLink: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_organization_user_signin_link_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserSigninLink]: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_organization_user_signin_link_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_signin_link_serialize( + self, + user, + user_signin_link_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if user_signin_link_creation is not None: + _body_params = user_signin_link_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users/{user}/signinLink', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_lti_configuration( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_lti_configuration_with_http_info( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_lti_configuration_without_preload_content( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_lti_configuration_serialize( + self, + configuration, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if configuration is not None: + _path_params['configuration'] = configuration + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/lti/configurations/{configuration}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_lti_configurations( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LtiConfiguration]: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_lti_configurations_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LtiConfiguration]]: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_lti_configurations_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_lti_configurations_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/lti/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_lti_credentials( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LtiCredentials]: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_lti_credentials_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LtiCredentials]]: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_lti_credentials_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_lti_credentials_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/lti/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_organization_invitations( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[OrganizationInvitation]: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_organization_invitations_with_http_info( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[OrganizationInvitation]]: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_organization_invitations_without_preload_content( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_organization_invitations_serialize( + self, + role, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if role is not None: + + _query_params.append(('role', role)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_organization_users( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserDetailsAdmin]: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_organization_users_with_http_info( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserDetailsAdmin]]: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_organization_users_without_preload_content( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_organization_users_serialize( + self, + sort, + direction, + next, + previous, + role, + q, + group, + no_active_license, + test_accounts, + license_expiration_date, + only_ids, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'role': 'multi', + 'group': 'multi', + 'licenseExpirationDate': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if role is not None: + + _query_params.append(('role', role)) + + if q is not None: + + _query_params.append(('q', q)) + + if group is not None: + + _query_params.append(('group', group)) + + if no_active_license is not None: + + _query_params.append(('noActiveLicense', no_active_license)) + + if test_accounts is not None: + + _query_params.append(('testAccounts', test_accounts)) + + if license_expiration_date is not None: + + _query_params.append(('licenseExpirationDate', license_expiration_date)) + + if only_ids is not None: + + _query_params.append(('onlyIds', only_ids)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def remove_organization_invitation( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def remove_organization_invitation_with_http_info( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def remove_organization_invitation_without_preload_content( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_organization_invitation_serialize( + self, + invitation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if invitation is not None: + _path_params['invitation'] = invitation + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/invitations/{invitation}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def remove_organization_user( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def remove_organization_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def remove_organization_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_organization_user_serialize( + self, + user, + convert_to_individual, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if convert_to_individual is not None: + + _query_params.append(('convertToIndividual', convert_to_individual)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def revoke_lti_credentials( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def revoke_lti_credentials_with_http_info( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def revoke_lti_credentials_without_preload_content( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _revoke_lti_credentials_serialize( + self, + credentials, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if credentials is not None: + _path_params['credentials'] = credentials + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/lti/credentials/{credentials}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_lti_configuration( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiConfiguration: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_lti_configuration_with_http_info( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiConfiguration]: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_lti_configuration_without_preload_content( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_lti_configuration_serialize( + self, + configuration, + lti_configuration_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if configuration is not None: + _path_params['configuration'] = configuration + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if lti_configuration_update is not None: + _body_params = lti_configuration_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/organizations/lti/configurations/{configuration}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_organization_user( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetailsAdmin: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_organization_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetailsAdmin]: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_organization_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_organization_user_serialize( + self, + user, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/organizations/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/score_api.py b/flat_api/aio/api/score_api.py new file mode 100644 index 0000000..46990ea --- /dev/null +++ b/flat_api/aio/api/score_api.py @@ -0,0 +1,9310 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.aio.models.assignment_submission import AssignmentSubmission +from flat_api.aio.models.resource_collaborator import ResourceCollaborator +from flat_api.aio.models.resource_collaborator_creation import ResourceCollaboratorCreation +from flat_api.aio.models.score_comment import ScoreComment +from flat_api.aio.models.score_comment_creation import ScoreCommentCreation +from flat_api.aio.models.score_comment_update import ScoreCommentUpdate +from flat_api.aio.models.score_creation import ScoreCreation +from flat_api.aio.models.score_details import ScoreDetails +from flat_api.aio.models.score_fork import ScoreFork +from flat_api.aio.models.score_modification import ScoreModification +from flat_api.aio.models.score_revision import ScoreRevision +from flat_api.aio.models.score_revision_creation import ScoreRevisionCreation +from flat_api.aio.models.score_track import ScoreTrack +from flat_api.aio.models.score_track_creation import ScoreTrackCreation +from flat_api.aio.models.score_track_creation_response import ScoreTrackCreationResponse +from flat_api.aio.models.score_track_update import ScoreTrackUpdate +from flat_api.aio.models.task import Task +from flat_api.aio.models.task_export_options import TaskExportOptions + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class ScoreApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def add_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ResourceCollaborator: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ResourceCollaborator]: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_collaborator_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/collaborators', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def add_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrackCreationResponse: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrackCreationResponse]: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_track_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/tracks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_export_task( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Task: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_export_task_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Task]: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_export_task_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_export_task_serialize( + self, + score, + revision, + format, + sharing_key, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + if format is not None: + _path_params['format'] = format + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/revisions/{revision}/{format}/task', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_score( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreDetails: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_score_with_http_info( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreDetails]: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_score_without_preload_content( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_score_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_score_revision( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreRevision: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_score_revision_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreRevision]: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_score_revision_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_score_revision_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/revisions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_serialize( + self, + score, + now, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if now is not None: + + _query_params.append(('now', now)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_comment_serialize( + self, + score, + comment, + event_properties, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_track_serialize( + self, + score, + track, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def edit_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def edit_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def edit_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_score_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def fork_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def fork_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def fork_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fork_score_serialize( + self, + score, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/fork', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_group_scores( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_group_scores_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_group_scores_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_scores_serialize( + self, + group, + parent, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ResourceCollaborator: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ResourceCollaborator]: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_collaborator_serialize( + self, + score, + collaborator, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if collaborator is not None: + _path_params['collaborator'] = collaborator + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/collaborators/{collaborator}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_collaborators( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_collaborators_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_collaborators_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_collaborators_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/collaborators', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_comments( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreComment]: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_comments_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreComment]]: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_comments_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_comments_serialize( + self, + score, + type, + sort, + direction, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_revision( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_revision_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_revision_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revision_serialize( + self, + score, + revision, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions/{revision}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_revision_data( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_revision_data_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_revision_data_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revision_data_serialize( + self, + score, + revision, + format, + sharing_key, + parts, + default_track, + url, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + if format is not None: + _path_params['format'] = format + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + if parts is not None: + + _query_params.append(('parts', parts)) + + if default_track is not None: + + _query_params.append(('defaultTrack', default_track)) + + if url is not None: + + _query_params.append(('url', url)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + 'application/vnd.recordare.musicxml+xml', + 'application/vnd.recordare.musicxml', + 'audio/mp3', + 'audio/wav', + 'audio/midi', + 'image/png', + 'application/octet-stream' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions/{revision}/{format}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_revisions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_revisions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_revisions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revisions_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_submissions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_submissions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_submissions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_submissions_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrack: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrack]: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_track_serialize( + self, + score, + track, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_user_likes( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_user_likes_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_user_likes_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_likes_serialize( + self, + user, + next, + previous, + limit, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/likes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_user_scores( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_user_scores_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_user_scores_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_scores_serialize( + self, + user, + paginate, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if paginate is not None: + + _query_params.append(('paginate', paginate)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_score_tracks( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_score_tracks_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_score_tracks_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_score_tracks_serialize( + self, + score, + sharing_key, + assignment, + list_auto_track, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + if assignment is not None: + + _query_params.append(('assignment', assignment)) + + if list_auto_track is not None: + + _query_params.append(('listAutoTrack', list_auto_track)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/tracks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def mark_score_comment_resolved( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def mark_score_comment_resolved_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def mark_score_comment_resolved_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _mark_score_comment_resolved_serialize( + self, + score, + comment, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/comments/{comment}/resolved', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def mark_score_comment_unresolved( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def mark_score_comment_unresolved_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def mark_score_comment_unresolved_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _mark_score_comment_unresolved_serialize( + self, + score, + comment, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/comments/{comment}/resolved', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def post_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def post_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def post_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_score_comment_serialize( + self, + score, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def remove_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def remove_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def remove_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_score_collaborator_serialize( + self, + score, + collaborator, + event_properties, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if collaborator is not None: + _path_params['collaborator'] = collaborator + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/collaborators/{collaborator}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def untrash_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def untrash_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def untrash_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _untrash_score_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/untrash', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreComment: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreComment]: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_score_comment_serialize( + self, + score, + comment, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrack: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrack]: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_score_track_serialize( + self, + score, + track, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/task_api.py b/flat_api/aio/api/task_api.py new file mode 100644 index 0000000..ffe56ab --- /dev/null +++ b/flat_api/aio/api/task_api.py @@ -0,0 +1,302 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from flat_api.aio.models.task import Task + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class TaskApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def get_task( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Task: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_task_with_http_info( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Task]: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_task_without_preload_content( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_task_serialize( + self, + task, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if task is not None: + _path_params['task'] = task + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/tasks/{task}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api/user_api.py b/flat_api/aio/api/user_api.py new file mode 100644 index 0000000..99952f3 --- /dev/null +++ b/flat_api/aio/api/user_api.py @@ -0,0 +1,999 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.score_details import ScoreDetails +from flat_api.aio.models.user_public import UserPublic + +from flat_api.aio.api_client import ApiClient, RequestSerialized +from flat_api.aio.api_response import ApiResponse +from flat_api.aio.rest import RESTResponseType + + +class UserApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def get_user( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserPublic: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserPublic]: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_serialize( + self, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_user_likes( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_user_likes_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_user_likes_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_likes_serialize( + self, + user, + next, + previous, + limit, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/likes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_user_scores( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_user_scores_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_user_scores_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_scores_serialize( + self, + user, + paginate, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if paginate is not None: + + _query_params.append(('paginate', paginate)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/aio/api_client.py b/flat_api/aio/api_client.py new file mode 100644 index 0000000..a394b77 --- /dev/null +++ b/flat_api/aio/api_client.py @@ -0,0 +1,823 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from flat_api.aio.configuration import Configuration +from flat_api.aio.api_response import ApiResponse, T as ApiResponseT +import flat_api.aio.models +from flat_api.aio import rest +from flat_api.aio.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/2.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(flat_api.aio.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, quote(str(value))) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters + cookie_value = str(auth_setting['value']) + if not re.match("^\".*\"$", cookie_value): + cookie_value = cookie_value.replace("\"", "\\\"") + cookie_value = f"\"{cookie_value}\"" + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/flat_api/aio/api_response.py b/flat_api/aio/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/flat_api/aio/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/flat_api/aio/configuration.py b/flat_api/aio/configuration.py new file mode 100644 index 0000000..09805f4 --- /dev/null +++ b/flat_api/aio/configuration.py @@ -0,0 +1,627 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import aiohttp +import aiohttp_retry +import base64 +import copy +import http.client as httplib +import logging +from logging import FileHandler +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "OAuth2": OAuth2AuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int | aiohttp_retry.RetryOptionsBase - Retry configuration. + :param trace_configs: list of aiohttp.TraceConfig instances forwarded to + aiohttp.ClientSession for tracing/instrumentation (e.g. OpenTelemetry). + :param tcp_connector_limit_per_host: Per-host concurrency cap forwarded to + aiohttp.TCPConnector(limit_per_host=...). None leaves aiohttp's default (0 = unlimited). + :param client_session_kwargs: Extra keyword arguments merged into + aiohttp.ClientSession(**kwargs) (e.g. json_serialize=orjson.dumps, + cookie_jar=aiohttp.DummyCookieJar()). + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + :Example: + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[Union[int, aiohttp_retry.RetryOptionsBase]] = None, + trace_configs: Optional[List[aiohttp.TraceConfig]] = None, + tcp_connector_limit_per_host: Optional[int] = None, + client_session_kwargs: Optional[Dict[str, Any]] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "https://api.flat.io/v2" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("flat_api_async") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 + """This value is passed to the aiohttp to limit simultaneous connections. + None in the constructor is coerced to default 100. + """ + + self.proxy = proxy + """Proxy URL + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + self.trace_configs = trace_configs + """aiohttp.TraceConfig list forwarded to ClientSession for tracing. + """ + self.tcp_connector_limit_per_host = tcp_connector_limit_per_host + """Per-host concurrency cap forwarded to TCPConnector. + """ + self.client_session_kwargs = client_session_kwargs + """Extra kwargs merged into aiohttp.ClientSession(**kwargs). + + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + if self.access_token is not None: + auth['OAuth2'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 2.26.2\n"\ + "SDK Package Version: 2.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.flat.io/v2", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/flat_api/aio/exceptions.py b/flat_api/aio/exceptions.py new file mode 100644 index 0000000..cc06420 --- /dev/null +++ b/flat_api/aio/exceptions.py @@ -0,0 +1,219 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/flat_api/aio/models/__init__.py b/flat_api/aio/models/__init__.py new file mode 100644 index 0000000..467e99e --- /dev/null +++ b/flat_api/aio/models/__init__.py @@ -0,0 +1,213 @@ +# coding: utf-8 + +# flake8: noqa +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from flat_api.aio.models.add_group_user200_response import AddGroupUser200Response +from flat_api.aio.models.add_group_user_request import AddGroupUserRequest +from flat_api.aio.models.api_access_token import ApiAccessToken +from flat_api.aio.models.app_scopes import AppScopes +from flat_api.aio.models.assignment import Assignment +from flat_api.aio.models.assignment_capabilities import AssignmentCapabilities +from flat_api.aio.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError +from flat_api.aio.models.assignment_copy import AssignmentCopy +from flat_api.aio.models.assignment_copy_response import AssignmentCopyResponse +from flat_api.aio.models.assignment_copy_to_class import AssignmentCopyToClass +from flat_api.aio.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary +from flat_api.aio.models.assignment_group import AssignmentGroup +from flat_api.aio.models.assignment_submission import AssignmentSubmission +from flat_api.aio.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.aio.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.aio.models.assignment_submission_comments import AssignmentSubmissionComments +from flat_api.aio.models.assignment_submission_history import AssignmentSubmissionHistory +from flat_api.aio.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment +from flat_api.aio.models.assignment_submission_history_state import AssignmentSubmissionHistoryState +from flat_api.aio.models.assignment_submission_lti import AssignmentSubmissionLti +from flat_api.aio.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.aio.models.assignment_submission_state import AssignmentSubmissionState +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.assignment_update import AssignmentUpdate +from flat_api.aio.models.class_assignment import ClassAssignment +from flat_api.aio.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas +from flat_api.aio.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti +from flat_api.aio.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc +from flat_api.aio.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.aio.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.aio.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph +from flat_api.aio.models.class_attachment_creation import ClassAttachmentCreation +from flat_api.aio.models.class_creation import ClassCreation +from flat_api.aio.models.class_details import ClassDetails +from flat_api.aio.models.class_details_canvas import ClassDetailsCanvas +from flat_api.aio.models.class_details_clever import ClassDetailsClever +from flat_api.aio.models.class_details_google_classroom import ClassDetailsGoogleClassroom +from flat_api.aio.models.class_details_google_drive import ClassDetailsGoogleDrive +from flat_api.aio.models.class_details_issues import ClassDetailsIssues +from flat_api.aio.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner +from flat_api.aio.models.class_details_lti import ClassDetailsLti +from flat_api.aio.models.class_details_mfc import ClassDetailsMfc +from flat_api.aio.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph +from flat_api.aio.models.class_grade_level import ClassGradeLevel +from flat_api.aio.models.class_roles import ClassRoles +from flat_api.aio.models.class_state import ClassState +from flat_api.aio.models.class_update import ClassUpdate +from flat_api.aio.models.collection import Collection +from flat_api.aio.models.collection_app import CollectionApp +from flat_api.aio.models.collection_capabilities import CollectionCapabilities +from flat_api.aio.models.collection_contents import CollectionContents +from flat_api.aio.models.collection_creation import CollectionCreation +from flat_api.aio.models.collection_modification import CollectionModification +from flat_api.aio.models.collection_privacy import CollectionPrivacy +from flat_api.aio.models.collection_type import CollectionType +from flat_api.aio.models.credit_transaction import CreditTransaction +from flat_api.aio.models.edu_library import EduLibrary +from flat_api.aio.models.edu_resource import EduResource +from flat_api.aio.models.edu_resource_assignment_creation import EduResourceAssignmentCreation +from flat_api.aio.models.edu_resource_capabilities import EduResourceCapabilities +from flat_api.aio.models.edu_resource_copy import EduResourceCopy +from flat_api.aio.models.edu_resource_creation import EduResourceCreation +from flat_api.aio.models.edu_resource_folder import EduResourceFolder +from flat_api.aio.models.edu_resource_lti_link import EduResourceLtiLink +from flat_api.aio.models.edu_resource_move import EduResourceMove +from flat_api.aio.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.aio.models.edu_resource_resource import EduResourceResource +from flat_api.aio.models.edu_resource_type import EduResourceType +from flat_api.aio.models.edu_resource_update import EduResourceUpdate +from flat_api.aio.models.edu_resource_use_in_class import EduResourceUseInClass +from flat_api.aio.models.flat_error_response import FlatErrorResponse +from flat_api.aio.models.google_classroom_coursework import GoogleClassroomCoursework +from flat_api.aio.models.google_classroom_submission import GoogleClassroomSubmission +from flat_api.aio.models.grade import Grade +from flat_api.aio.models.group import Group +from flat_api.aio.models.group_creation import GroupCreation +from flat_api.aio.models.group_details import GroupDetails +from flat_api.aio.models.group_type import GroupType +from flat_api.aio.models.license_mode import LicenseMode +from flat_api.aio.models.license_sources import LicenseSources +from flat_api.aio.models.lms_name import LmsName +from flat_api.aio.models.lti_configuration import LtiConfiguration +from flat_api.aio.models.lti_configuration1p1 import LtiConfiguration1p1 +from flat_api.aio.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool +from flat_api.aio.models.lti_configuration1p3 import LtiConfiguration1p3 +from flat_api.aio.models.lti_configuration1p3_base import LtiConfiguration1p3Base +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.aio.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.aio.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from flat_api.aio.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment +from flat_api.aio.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic +from flat_api.aio.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual +from flat_api.aio.models.lti_configuration_base import LtiConfigurationBase +from flat_api.aio.models.lti_configuration_create import LtiConfigurationCreate +from flat_api.aio.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 +from flat_api.aio.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment +from flat_api.aio.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic +from flat_api.aio.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo +from flat_api.aio.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual +from flat_api.aio.models.lti_configuration_update import LtiConfigurationUpdate +from flat_api.aio.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment +from flat_api.aio.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone +from flat_api.aio.models.lti_credentials import LtiCredentials +from flat_api.aio.models.lti_credentials_creation import LtiCredentialsCreation +from flat_api.aio.models.media_attachment import MediaAttachment +from flat_api.aio.models.media_score_sharing_mode import MediaScoreSharingMode +from flat_api.aio.models.microsoft_graph_assignment import MicrosoftGraphAssignment +from flat_api.aio.models.microsoft_graph_submission import MicrosoftGraphSubmission +from flat_api.aio.models.omr_capabilities import OmrCapabilities +from flat_api.aio.models.omr_details_step_data import OmrDetailsStepData +from flat_api.aio.models.omr_details_submission import OmrDetailsSubmission +from flat_api.aio.models.omr_detected_instrument import OmrDetectedInstrument +from flat_api.aio.models.omr_imported_metadata import OmrImportedMetadata +from flat_api.aio.models.omr_instrument_override import OmrInstrumentOverride +from flat_api.aio.models.omr_job import OmrJob +from flat_api.aio.models.omr_job_creation import OmrJobCreation +from flat_api.aio.models.omr_job_file_metadata import OmrJobFileMetadata +from flat_api.aio.models.omr_job_file_upload import OmrJobFileUpload +from flat_api.aio.models.omr_job_file_upload_result import OmrJobFileUploadResult +from flat_api.aio.models.omr_job_input_file import OmrJobInputFile +from flat_api.aio.models.omr_job_output import OmrJobOutput +from flat_api.aio.models.omr_job_progress import OmrJobProgress +from flat_api.aio.models.omr_job_result import OmrJobResult +from flat_api.aio.models.omr_job_retention import OmrJobRetention +from flat_api.aio.models.omr_job_status import OmrJobStatus +from flat_api.aio.models.omr_locale_details import OmrLocaleDetails +from flat_api.aio.models.omr_pending_step import OmrPendingStep +from flat_api.aio.models.omr_step_name import OmrStepName +from flat_api.aio.models.organization_invitation import OrganizationInvitation +from flat_api.aio.models.organization_invitation_creation import OrganizationInvitationCreation +from flat_api.aio.models.organization_roles import OrganizationRoles +from flat_api.aio.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation +from flat_api.aio.models.rename_group_request import RenameGroupRequest +from flat_api.aio.models.resource_collaborator import ResourceCollaborator +from flat_api.aio.models.resource_collaborator_creation import ResourceCollaboratorCreation +from flat_api.aio.models.resource_rights import ResourceRights +from flat_api.aio.models.score_comment import ScoreComment +from flat_api.aio.models.score_comment_context import ScoreCommentContext +from flat_api.aio.models.score_comment_creation import ScoreCommentCreation +from flat_api.aio.models.score_comment_moderation import ScoreCommentModeration +from flat_api.aio.models.score_comment_update import ScoreCommentUpdate +from flat_api.aio.models.score_comments_counts import ScoreCommentsCounts +from flat_api.aio.models.score_creation import ScoreCreation +from flat_api.aio.models.score_creation_builder_data import ScoreCreationBuilderData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from flat_api.aio.models.score_creation_common import ScoreCreationCommon +from flat_api.aio.models.score_creation_file_import import ScoreCreationFileImport +from flat_api.aio.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport +from flat_api.aio.models.score_creation_type import ScoreCreationType +from flat_api.aio.models.score_details import ScoreDetails +from flat_api.aio.models.score_details_all_of_me import ScoreDetailsAllOfMe +from flat_api.aio.models.score_fork import ScoreFork +from flat_api.aio.models.score_license import ScoreLicense +from flat_api.aio.models.score_likes_counts import ScoreLikesCounts +from flat_api.aio.models.score_modification import ScoreModification +from flat_api.aio.models.score_plays_counts import ScorePlaysCounts +from flat_api.aio.models.score_privacy import ScorePrivacy +from flat_api.aio.models.score_revision import ScoreRevision +from flat_api.aio.models.score_revision_creation import ScoreRevisionCreation +from flat_api.aio.models.score_revision_statistics import ScoreRevisionStatistics +from flat_api.aio.models.score_source import ScoreSource +from flat_api.aio.models.score_summary import ScoreSummary +from flat_api.aio.models.score_track import ScoreTrack +from flat_api.aio.models.score_track_creation import ScoreTrackCreation +from flat_api.aio.models.score_track_creation_response import ScoreTrackCreationResponse +from flat_api.aio.models.score_track_point import ScoreTrackPoint +from flat_api.aio.models.score_track_purpose import ScoreTrackPurpose +from flat_api.aio.models.score_track_state import ScoreTrackState +from flat_api.aio.models.score_track_type import ScoreTrackType +from flat_api.aio.models.score_track_update import ScoreTrackUpdate +from flat_api.aio.models.score_views_counts import ScoreViewsCounts +from flat_api.aio.models.task import Task +from flat_api.aio.models.task_export_options import TaskExportOptions +from flat_api.aio.models.task_progress import TaskProgress +from flat_api.aio.models.task_result import TaskResult +from flat_api.aio.models.teaching_theme import TeachingTheme +from flat_api.aio.models.tutteo_product import TutteoProduct +from flat_api.aio.models.user_admin_update import UserAdminUpdate +from flat_api.aio.models.user_azure_details import UserAzureDetails +from flat_api.aio.models.user_basics import UserBasics +from flat_api.aio.models.user_community_profile_links import UserCommunityProfileLinks +from flat_api.aio.models.user_creation import UserCreation +from flat_api.aio.models.user_details import UserDetails +from flat_api.aio.models.user_details_admin import UserDetailsAdmin +from flat_api.aio.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense +from flat_api.aio.models.user_public import UserPublic +from flat_api.aio.models.user_public_summary import UserPublicSummary +from flat_api.aio.models.user_signin_link import UserSigninLink +from flat_api.aio.models.user_signin_link_creation import UserSigninLinkCreation + diff --git a/flat_api/aio/models/add_group_user200_response.py b/flat_api/aio/models/add_group_user200_response.py new file mode 100644 index 0000000..b5bce9e --- /dev/null +++ b/flat_api/aio/models/add_group_user200_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AddGroupUser200Response(BaseModel): + """ + AddGroupUser200Response + """ # noqa: E501 + user: Optional[StrictStr] = Field(default=None, description="User ID that was added") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AddGroupUser200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AddGroupUser200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/add_group_user_request.py b/flat_api/aio/models/add_group_user_request.py new file mode 100644 index 0000000..6225bc6 --- /dev/null +++ b/flat_api/aio/models/add_group_user_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AddGroupUserRequest(BaseModel): + """ + AddGroupUserRequest + """ # noqa: E501 + user: StrictStr = Field(description="ID of the student to add") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AddGroupUserRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AddGroupUserRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/api_access_token.py b/flat_api/aio/models/api_access_token.py new file mode 100644 index 0000000..f505de4 --- /dev/null +++ b/flat_api/aio/models/api_access_token.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.app_scopes import AppScopes +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ApiAccessToken(BaseModel): + """ + An API access token + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of this private token") + name: Optional[StrictStr] = Field(default=None, description="Name of the personal access token") + token: Optional[StrictStr] = Field(default=None, description="The token. This token will only be returned once, then only the first 4 characters will be returned. ") + issued_date: Optional[datetime] = Field(default=None, description="The date when this token was issued ", alias="issuedDate") + expiration_date: Optional[datetime] = Field(default=None, description="The date when this token will expire ", alias="expirationDate") + scopes: Optional[List[AppScopes]] = Field(default=None, description="The list of scopes associated to the token ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "token", "issuedDate", "expirationDate", "scopes"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiAccessToken from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiAccessToken from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "token": obj.get("token"), + "issuedDate": obj.get("issuedDate"), + "expirationDate": obj.get("expirationDate"), + "scopes": obj.get("scopes") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/app_scopes.py b/flat_api/aio/models/app_scopes.py new file mode 100644 index 0000000..f0207eb --- /dev/null +++ b/flat_api/aio/models/app_scopes.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AppScopes(str, Enum): + """ + Available scopes + """ + + """ + allowed enum values + """ + ACCOUNT_DOT_PUBLIC_PROFILE = 'account.public_profile' + ACCOUNT_DOT_EMAIL = 'account.email' + ACCOUNT_DOT_EDUCATION_PROFILE = 'account.education_profile' + SCORES_DOT_READONLY = 'scores.readonly' + SCORES_DOT_SOCIAL = 'scores.social' + SCORES = 'scores' + COLLECTIONS_DOT_READONLY = 'collections.readonly' + COLLECTIONS_DOT_ADD_SCORES = 'collections.add_scores' + COLLECTIONS = 'collections' + NOTIFICATIONS_DOT_READONLY = 'notifications.readonly' + EDU_DOT_RESOURCES = 'edu.resources' + EDU_DOT_RESOURCES_DOT_READONLY = 'edu.resources.readonly' + EDU_DOT_CLASSES = 'edu.classes' + EDU_DOT_CLASSES_DOT_READONLY = 'edu.classes.readonly' + EDU_DOT_ASSIGNMENTS = 'edu.assignments' + EDU_DOT_ASSIGNMENTS_DOT_READONLY = 'edu.assignments.readonly' + EDU_DOT_ADMIN = 'edu.admin' + EDU_DOT_ADMIN_DOT_LTI = 'edu.admin.lti' + EDU_DOT_ADMIN_DOT_LTI_DOT_READONLY = 'edu.admin.lti.readonly' + EDU_DOT_ADMIN_DOT_USERS = 'edu.admin.users' + EDU_DOT_ADMIN_DOT_USERS_DOT_READONLY = 'edu.admin.users.readonly' + TASKS_DOT_READONLY = 'tasks.readonly' + OMR = 'omr' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AppScopes from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/assignment.py b/flat_api/aio/models/assignment.py new file mode 100644 index 0000000..91574ef --- /dev/null +++ b/flat_api/aio/models/assignment.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_capabilities import AssignmentCapabilities +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.media_attachment import MediaAttachment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Assignment(BaseModel): + """ + Assignment details + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Assignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Assignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_capabilities.py b/flat_api/aio/models/assignment_capabilities.py new file mode 100644 index 0000000..9a6ffba --- /dev/null +++ b/flat_api/aio/models/assignment_capabilities.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCapabilities(BaseModel): + """ + Capabilities the current user has on this assignment. Each capability corresponds to a fine-grained action that a user may take. + """ # noqa: E501 + can_edit: StrictBool = Field(description="Whether the current user can edit the assignment ", alias="canEdit") + can_publish_in_class: StrictBool = Field(description="Whether this assignment can be published in a class ", alias="canPublishInClass") + can_publish_in_class_error: Optional[AssignmentCapabilitiesCanPublishInClassError] = Field(default=None, alias="canPublishInClassError") + can_archive: StrictBool = Field(description="Whether the current user can archive the assignment ", alias="canArchive") + can_unarchive: StrictBool = Field(description="Whether the current user can unarchive the assignment ", alias="canUnarchive") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canPublishInClass", "canPublishInClassError", "canArchive", "canUnarchive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of can_publish_in_class_error + if self.can_publish_in_class_error: + _dict['canPublishInClassError'] = self.can_publish_in_class_error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canPublishInClass": obj.get("canPublishInClass"), + "canPublishInClassError": AssignmentCapabilitiesCanPublishInClassError.from_dict(obj["canPublishInClassError"]) if obj.get("canPublishInClassError") is not None else None, + "canArchive": obj.get("canArchive"), + "canUnarchive": obj.get("canUnarchive") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_capabilities_can_publish_in_class_error.py b/flat_api/aio/models/assignment_capabilities_can_publish_in_class_error.py new file mode 100644 index 0000000..2cefdf8 --- /dev/null +++ b/flat_api/aio/models/assignment_capabilities_can_publish_in_class_error.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCapabilitiesCanPublishInClassError(BaseModel): + """ + If `canPublishInClass` and `canEdit` are false, the issue why this assignment cannot be published in a class + """ # noqa: E501 + code: StrictStr = Field(description="A corresponding code for this error") + message: StrictStr = Field(description="A printable and localized message for this error") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCapabilitiesCanPublishInClassError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCapabilitiesCanPublishInClassError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_copy.py b/flat_api/aio/models/assignment_copy.py new file mode 100644 index 0000000..ed61a49 --- /dev/null +++ b/flat_api/aio/models/assignment_copy.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.assignment_copy_to_class import AssignmentCopyToClass +from flat_api.aio.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +ASSIGNMENTCOPY_ONE_OF_SCHEMAS = ["AssignmentCopyToClass", "AssignmentCopyToResourceLibrary"] + +class AssignmentCopy(BaseModel): + """ + AssignmentCopy + """ + # data type: AssignmentCopyToClass + oneof_schema_1_validator: Optional[AssignmentCopyToClass] = None + # data type: AssignmentCopyToResourceLibrary + oneof_schema_2_validator: Optional[AssignmentCopyToResourceLibrary] = None + actual_instance: Optional[Union[AssignmentCopyToClass, AssignmentCopyToResourceLibrary]] = None + one_of_schemas: Set[str] = { "AssignmentCopyToClass", "AssignmentCopyToResourceLibrary" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = AssignmentCopy.model_construct() + error_messages = [] + match = 0 + # validate data type: AssignmentCopyToClass + if not isinstance(v, AssignmentCopyToClass): + error_messages.append(f"Error! Input type `{type(v)}` is not `AssignmentCopyToClass`") + else: + match += 1 + # validate data type: AssignmentCopyToResourceLibrary + if not isinstance(v, AssignmentCopyToResourceLibrary): + error_messages.append(f"Error! Input type `{type(v)}` is not `AssignmentCopyToResourceLibrary`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into AssignmentCopyToClass + try: + instance.actual_instance = AssignmentCopyToClass.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into AssignmentCopyToResourceLibrary + try: + instance.actual_instance = AssignmentCopyToResourceLibrary.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], AssignmentCopyToClass, AssignmentCopyToResourceLibrary]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/assignment_copy_response.py b/flat_api/aio/models/assignment_copy_response.py new file mode 100644 index 0000000..87b0d93 --- /dev/null +++ b/flat_api/aio/models/assignment_copy_response.py @@ -0,0 +1,186 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_capabilities import AssignmentCapabilities +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.media_attachment import MediaAttachment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyResponse(BaseModel): + """ + AssignmentCopyResponse + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + resource: Optional[StrictStr] = Field(default=None, description="If this assignment is stored as a resource in the Flat for Education Resource Library, the unique identifier of the resource.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "resource"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "resource": obj.get("resource") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_copy_to_class.py b/flat_api/aio/models/assignment_copy_to_class.py new file mode 100644 index 0000000..b258cb0 --- /dev/null +++ b/flat_api/aio/models/assignment_copy_to_class.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyToClass(BaseModel): + """ + Copy the assignment to a class + """ # noqa: E501 + classroom: StrictStr = Field(description="The destination classroom where the assignment will be copied") + assignment: Optional[StrictStr] = Field(default=None, description="An optional destination assignment where the original assignment will be copied. Must be a draft.") + scheduled_date: Optional[datetime] = Field(default=None, description="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. ", alias="scheduledDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["classroom", "assignment", "scheduledDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyToClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyToClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "scheduledDate": obj.get("scheduledDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_copy_to_resource_library.py b/flat_api/aio/models/assignment_copy_to_resource_library.py new file mode 100644 index 0000000..85c5932 --- /dev/null +++ b/flat_api/aio/models/assignment_copy_to_resource_library.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyToResourceLibrary(BaseModel): + """ + Copy the assignment to the EDU Resource Library + """ # noqa: E501 + library_parent: StrictStr = Field(description="Identifier of the parent resource where the new one will be created, e.g. a folder id or `root`", alias="libraryParent") + verify_if_not_already_in_resource_library: Optional[StrictBool] = Field(default=None, description="Option to check if the assignment is already in Resource Library", alias="verifyIfNotAlreadyInResourceLibrary") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["libraryParent", "verifyIfNotAlreadyInResourceLibrary"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyToResourceLibrary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyToResourceLibrary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "libraryParent": obj.get("libraryParent"), + "verifyIfNotAlreadyInResourceLibrary": obj.get("verifyIfNotAlreadyInResourceLibrary") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_group.py b/flat_api/aio/models/assignment_group.py new file mode 100644 index 0000000..bf63557 --- /dev/null +++ b/flat_api/aio/models/assignment_group.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentGroup(BaseModel): + """ + A group assigned to an assignment for shared writing assignments + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the group") + name: StrictStr = Field(description="The display name of the group") + parent: Optional[StrictStr] = Field(default=None, description="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.") + members: List[StrictStr] = Field(description="Array of user IDs that are members of this group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "parent", "members"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "parent": obj.get("parent"), + "members": obj.get("members") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission.py b/flat_api/aio/models/assignment_submission.py new file mode 100644 index 0000000..c00b61f --- /dev/null +++ b/flat_api/aio/models/assignment_submission.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_submission_comments import AssignmentSubmissionComments +from flat_api.aio.models.assignment_submission_lti import AssignmentSubmissionLti +from flat_api.aio.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.aio.models.assignment_submission_state import AssignmentSubmissionState +from flat_api.aio.models.google_classroom_submission import GoogleClassroomSubmission +from flat_api.aio.models.media_attachment import MediaAttachment +from flat_api.aio.models.microsoft_graph_submission import MicrosoftGraphSubmission +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmission(BaseModel): + """ + Assignment Submission + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the submission") + state: AssignmentSubmissionState + classroom: StrictStr = Field(description="Unique identifier of the classroom where the assignment was posted ") + assignment: StrictStr = Field(description="Unique identifier of the assignment") + creator: StrictStr = Field(description="The User identifier of the student who created the submission") + creation_date: StrictStr = Field(description="The date when the submission was created", alias="creationDate") + attachments: List[MediaAttachment] + submission_date: Optional[StrictStr] = Field(default=None, description="The date when the student submitted their work", alias="submissionDate") + return_date: Optional[StrictStr] = Field(default=None, description="The date when the teacher returned the work", alias="returnDate") + return_creator: Optional[StrictStr] = Field(default=None, description="The User unique identifier of the teacher who returned the submission ", alias="returnCreator") + grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional grade. If unset, no grade was set.") + draft_grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional grade. If unset, no grade was set. This value is only visible to the teacher, and is copied to `grade` once the teacher returns the submission", alias="draftGrade") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional max points for the grade. If set, a corresponding `draftGrade` or `grade` will be set.", alias="maxPoints") + exercises_ids: Optional[List[StrictStr]] = Field(default=None, description="The ids of exercises when they need to be in a specific order", alias="exercisesIds") + playback: List[AssignmentSubmissionPlayback] + comments: AssignmentSubmissionComments + google_classroom: Optional[GoogleClassroomSubmission] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[MicrosoftGraphSubmission] = Field(default=None, alias="microsoftGraph") + lti: Optional[AssignmentSubmissionLti] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "classroom", "assignment", "creator", "creationDate", "attachments", "submissionDate", "returnDate", "returnCreator", "grade", "draftGrade", "maxPoints", "exercisesIds", "playback", "comments", "googleClassroom", "microsoftGraph", "lti"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in playback (list) + _items = [] + if self.playback: + for _item_playback in self.playback: + if _item_playback: + _items.append(_item_playback.to_dict()) + _dict['playback'] = _items + # override the default output from pydantic by calling `to_dict()` of comments + if self.comments: + _dict['comments'] = self.comments.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if grade (nullable) is None + # and model_fields_set contains the field + if self.grade is None and "grade" in self.model_fields_set: + _dict['grade'] = None + + # set to None if draft_grade (nullable) is None + # and model_fields_set contains the field + if self.draft_grade is None and "draft_grade" in self.model_fields_set: + _dict['draftGrade'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "submissionDate": obj.get("submissionDate"), + "returnDate": obj.get("returnDate"), + "returnCreator": obj.get("returnCreator"), + "grade": obj.get("grade"), + "draftGrade": obj.get("draftGrade"), + "maxPoints": obj.get("maxPoints"), + "exercisesIds": obj.get("exercisesIds"), + "playback": [AssignmentSubmissionPlayback.from_dict(_item) for _item in obj["playback"]] if obj.get("playback") is not None else None, + "comments": AssignmentSubmissionComments.from_dict(obj["comments"]) if obj.get("comments") is not None else None, + "googleClassroom": GoogleClassroomSubmission.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": MicrosoftGraphSubmission.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "lti": AssignmentSubmissionLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_comment.py b/flat_api/aio/models/assignment_submission_comment.py new file mode 100644 index 0000000..8082328 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_comment.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionComment(BaseModel): + """ + Feedback comment added to an assignment submission + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The comment unique identifier") + user: Optional[StrictStr] = Field(default=None, description="The author unique identifier") + submission: Optional[StrictStr] = Field(default=None, description="The submission unique identifier") + var_date: Optional[datetime] = Field(default=None, description="The date when the comment was posted", alias="date") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last comment modification", alias="modificationDate") + comment: Optional[StrictStr] = Field(default=None, description="The comment text") + unread: Optional[StrictBool] = Field(default=None, description="True if the comment is unread by the current user") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "user", "submission", "date", "modificationDate", "comment", "unread"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "user": obj.get("user"), + "submission": obj.get("submission"), + "date": obj.get("date"), + "modificationDate": obj.get("modificationDate"), + "comment": obj.get("comment"), + "unread": obj.get("unread") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_comment_creation.py b/flat_api/aio/models/assignment_submission_comment_creation.py new file mode 100644 index 0000000..86e1266 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_comment_creation.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionCommentCreation(BaseModel): + """ + Creation of an assignment submission comment + """ # noqa: E501 + comment: StrictStr = Field(description="The comment text") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["comment"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionCommentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionCommentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "comment": obj.get("comment") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_comments.py b/flat_api/aio/models/assignment_submission_comments.py new file mode 100644 index 0000000..5b1f518 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_comments.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionComments(BaseModel): + """ + AssignmentSubmissionComments + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of comments added to the submission") + unread: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of unread comments for the current user") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "unread"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "unread": obj.get("unread") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_history.py b/flat_api/aio/models/assignment_submission_history.py new file mode 100644 index 0000000..ac11220 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_history.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment +from flat_api.aio.models.assignment_submission_history_state import AssignmentSubmissionHistoryState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionHistory(BaseModel): + """ + History item of the submission + """ # noqa: E501 + var_date: datetime = Field(description="The date when the submission was changed", alias="date") + classroom: Optional[StrictStr] = Field(default=None, description="The classroom unique identifier where the submission was changed") + assignment: Optional[StrictStr] = Field(default=None, description="The assignment unique identifier where the submission was changed") + submission: Optional[StrictStr] = Field(default=None, description="The submission unique identifier") + users: List[StrictStr] = Field(description="The user(s) unique identifier(s) who made the change") + source: Optional[StrictStr] = Field(default=None, description="The source of the change if the change was made by a third-party software") + state: Optional[AssignmentSubmissionHistoryState] = None + draft_grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The numerator of the grade at this time in the submission grade history", alias="draftGrade") + grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The numerator of the grade at this time in the submission grade history") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The denominator of the grade at this time in the submission grade history", alias="maxPoints") + comment: Optional[StrictStr] = Field(default=None, description="The comment that is made to this submission") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment", alias="dueDate") + attachment: Optional[AssignmentSubmissionHistoryAttachment] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["date", "classroom", "assignment", "submission", "users", "source", "state", "draftGrade", "grade", "maxPoints", "comment", "dueDate", "attachment"] + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['lti', 'googleClassroom', 'microsoftGraph']): + raise ValueError("must be one of enum values ('lti', 'googleClassroom', 'microsoftGraph')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of attachment + if self.attachment: + _dict['attachment'] = self.attachment.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "submission": obj.get("submission"), + "users": obj.get("users"), + "source": obj.get("source"), + "state": obj.get("state"), + "draftGrade": obj.get("draftGrade"), + "grade": obj.get("grade"), + "maxPoints": obj.get("maxPoints"), + "comment": obj.get("comment"), + "dueDate": obj.get("dueDate"), + "attachment": AssignmentSubmissionHistoryAttachment.from_dict(obj["attachment"]) if obj.get("attachment") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_history_attachment.py b/flat_api/aio/models/assignment_submission_history_attachment.py new file mode 100644 index 0000000..3fae711 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_history_attachment.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionHistoryAttachment(BaseModel): + """ + AssignmentSubmissionHistoryAttachment + """ # noqa: E501 + score: Optional[StrictStr] = Field(default=None, description="The score identifier that changed") + revision: Optional[StrictStr] = Field(default=None, description="The revision identifier that changed") + title: Optional[StrictStr] = Field(default=None, description="The title of the score that changed") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "revision", "title"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistoryAttachment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistoryAttachment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "revision": obj.get("revision"), + "title": obj.get("title") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_history_state.py b/flat_api/aio/models/assignment_submission_history_state.py new file mode 100644 index 0000000..810de63 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_history_state.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionHistoryState(str, Enum): + """ + State of the submission history + """ + + """ + allowed enum values + """ + CREATED = 'created' + TURNEDIN = 'turnedIn' + RETURNED = 'returned' + GRADED = 'graded' + RESET = 'reset' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionHistoryState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/assignment_submission_lti.py b/flat_api/aio/models/assignment_submission_lti.py new file mode 100644 index 0000000..d0076d3 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_lti.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionLti(BaseModel): + """ + If set, this submission has a linked LTI 1.3 AGS or LTI 1.1 Outcomes + """ # noqa: E501 + grade_service: StrictStr = Field(description="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 ", alias="gradeService") + sourcedid: Optional[StrictStr] = Field(default=None, description="The sourcedid of the LTI submission when using LTI Outcomes") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["gradeService", "sourcedid"] + + @field_validator('grade_service') + def grade_service_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ags2p0', 'outcomes1p1']): + raise ValueError("must be one of enum values ('ags2p0', 'outcomes1p1')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "gradeService": obj.get("gradeService"), + "sourcedid": obj.get("sourcedid") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_playback.py b/flat_api/aio/models/assignment_submission_playback.py new file mode 100644 index 0000000..5713ea1 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_playback.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionPlayback(BaseModel): + """ + Playback used by a student for an assignment submission. + """ # noqa: E501 + score: StrictStr = Field(description="The score unique identifier") + nb_play_attempt: Union[StrictFloat, StrictInt] = Field(description="Number of times the score was played", alias="nbPlayAttempt") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "nbPlayAttempt"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionPlayback from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionPlayback from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "nbPlayAttempt": obj.get("nbPlayAttempt") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_submission_state.py b/flat_api/aio/models/assignment_submission_state.py new file mode 100644 index 0000000..d591dc8 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_state.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionState(str, Enum): + """ + State of the submission + """ + + """ + allowed enum values + """ + CREATED = 'created' + TURNEDIN = 'turnedIn' + RETURNED = 'returned' + GRADED = 'graded' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/assignment_submission_students_mode.py b/flat_api/aio/models/assignment_submission_students_mode.py new file mode 100644 index 0000000..0838698 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_students_mode.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionStudentsMode(str, Enum): + """ + Submission mode for assignments: - \"single\": Individual submissions (default) - \"group\": Group submissions (for shared writing assignments) + """ + + """ + allowed enum values + """ + SINGLE = 'single' + GROUP = 'group' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionStudentsMode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/assignment_submission_update.py b/flat_api/aio/models/assignment_submission_update.py new file mode 100644 index 0000000..089bcf6 --- /dev/null +++ b/flat_api/aio/models/assignment_submission_update.py @@ -0,0 +1,146 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.aio.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionUpdate(BaseModel): + """ + Assignment Submission creation + """ # noqa: E501 + attachments: Optional[List[ClassAttachmentCreation]] = None + playback: Optional[List[AssignmentSubmissionPlayback]] = None + submit: Optional[StrictBool] = Field(default=None, description="If `true`, the submission will be marked as done") + draft_grade: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="Optional grade. If unset, no grade was set. This value is only visible to the teacher, and is copied to `grade` once the teacher returns the submission", alias="draftGrade") + grade: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="Optional grade. If unset, no grade was set.") + exercises_ids: Optional[List[StrictStr]] = Field(default=None, description="The ids of exercises when they need to be in a specific order", alias="exercisesIds") + var_return: Optional[StrictBool] = Field(default=None, description="If `true`, the submission will be returned to the student (teachers only)", alias="return") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["attachments", "playback", "submit", "draftGrade", "grade", "exercisesIds", "return"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in playback (list) + _items = [] + if self.playback: + for _item_playback in self.playback: + if _item_playback: + _items.append(_item_playback.to_dict()) + _dict['playback'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if draft_grade (nullable) is None + # and model_fields_set contains the field + if self.draft_grade is None and "draft_grade" in self.model_fields_set: + _dict['draftGrade'] = None + + # set to None if grade (nullable) is None + # and model_fields_set contains the field + if self.grade is None and "grade" in self.model_fields_set: + _dict['grade'] = None + + # set to None if exercises_ids (nullable) is None + # and model_fields_set contains the field + if self.exercises_ids is None and "exercises_ids" in self.model_fields_set: + _dict['exercisesIds'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "playback": [AssignmentSubmissionPlayback.from_dict(_item) for _item in obj["playback"]] if obj.get("playback") is not None else None, + "submit": obj.get("submit"), + "draftGrade": obj.get("draftGrade"), + "grade": obj.get("grade"), + "exercisesIds": obj.get("exercisesIds"), + "return": obj.get("return") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/assignment_type.py b/flat_api/aio/models/assignment_type.py new file mode 100644 index 0000000..b4d3b26 --- /dev/null +++ b/flat_api/aio/models/assignment_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentType(str, Enum): + """ + Type of the assignment + """ + + """ + allowed enum values + """ + NONE = 'none' + NEWSCORE = 'newScore' + SCORETEMPLATE = 'scoreTemplate' + SHAREDWRITING = 'sharedWriting' + WORKSHEET = 'worksheet' + WORKSHEETTEXT = 'worksheetText' + PERFORMANCE = 'performance' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/assignment_update.py b/flat_api/aio/models/assignment_update.py new file mode 100644 index 0000000..ac4de13 --- /dev/null +++ b/flat_api/aio/models/assignment_update.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentUpdate(BaseModel): + """ + Assignment Resource Editing + """ # noqa: E501 + type: Optional[AssignmentType] = None + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the assignment") + description: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Teacher-only instructions (plain text)", alias="teacherInstructions") + teacher_instructions_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + attachments: Optional[List[ClassAttachmentCreation]] = Field(default=None, description="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`. ") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + toolset: Optional[StrictStr] = Field(default=None, description="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. ") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + max_points: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="If set, the grading will be enabled for the assignment with this value as the maximum of points ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "attachments", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "toolset", "coverFile", "cover", "maxPoints", "releaseGrades", "shuffleExercises", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if nb_playback_authorized (nullable) is None + # and model_fields_set contains the field + if self.nb_playback_authorized is None and "nb_playback_authorized" in self.model_fields_set: + _dict['nbPlaybackAuthorized'] = None + + # set to None if toolset (nullable) is None + # and model_fields_set contains the field + if self.toolset is None and "toolset" in self.model_fields_set: + _dict['toolset'] = None + + # set to None if cover_file (nullable) is None + # and model_fields_set contains the field + if self.cover_file is None and "cover_file" in self.model_fields_set: + _dict['coverFile'] = None + + # set to None if cover (nullable) is None + # and model_fields_set contains the field + if self.cover is None and "cover" in self.model_fields_set: + _dict['cover'] = None + + # set to None if max_points (nullable) is None + # and model_fields_set contains the field + if self.max_points is None and "max_points" in self.model_fields_set: + _dict['maxPoints'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "toolset": obj.get("toolset"), + "coverFile": obj.get("coverFile"), + "cover": obj.get("cover"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment.py b/flat_api/aio/models/class_assignment.py new file mode 100644 index 0000000..1b365fe --- /dev/null +++ b/flat_api/aio/models/class_assignment.py @@ -0,0 +1,270 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_capabilities import AssignmentCapabilities +from flat_api.aio.models.assignment_group import AssignmentGroup +from flat_api.aio.models.assignment_submission import AssignmentSubmission +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas +from flat_api.aio.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti +from flat_api.aio.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc +from flat_api.aio.models.google_classroom_coursework import GoogleClassroomCoursework +from flat_api.aio.models.media_attachment import MediaAttachment +from flat_api.aio.models.microsoft_graph_assignment import MicrosoftGraphAssignment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignment(BaseModel): + """ + ClassAssignment + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + creator: Optional[StrictStr] = Field(default=None, description="The User unique identifier of the creator of this assignment ") + state: StrictStr = Field(description="State of the assignment") + classroom: Optional[StrictStr] = Field(default=None, description="The unique identifier of the class where this assignment was posted") + creation_date: datetime = Field(description="The creation date of this assignment", alias="creationDate") + scheduled_date: Optional[datetime] = Field(default=None, description="The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. ", alias="scheduledDate") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment, late submissions will be marked as past due. ", alias="dueDate") + assignee_mode: Optional[StrictStr] = Field(default=None, description="Possible modes of assigning assignments", alias="assigneeMode") + assigned_students: Optional[List[StrictStr]] = Field(default=None, description="Identifiers for the students that have access to the assignment", alias="assignedStudents") + assigned_groups: Optional[List[AssignmentGroup]] = Field(default=None, description="Groups that have access to the assignment (for shared writing assignments)", alias="assignedGroups") + submissions: List[AssignmentSubmission] + google_classroom: Optional[GoogleClassroomCoursework] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[MicrosoftGraphAssignment] = Field(default=None, alias="microsoftGraph") + mfc: Optional[ClassAssignmentAllOfMfc] = None + canvas: Optional[ClassAssignmentAllOfCanvas] = None + lti: Optional[ClassAssignmentAllOfLti] = None + issue: Optional[StrictStr] = Field(default=None, description="Detected issue for this assignment") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "creator", "state", "classroom", "creationDate", "scheduledDate", "dueDate", "assigneeMode", "assignedStudents", "assignedGroups", "submissions", "googleClassroom", "microsoftGraph", "mfc", "canvas", "lti", "issue"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['draft', 'active', 'archived']): + raise ValueError("must be one of enum values ('draft', 'active', 'archived')") + return value + + @field_validator('assignee_mode') + def assignee_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['everyone', 'selected']): + raise ValueError("must be one of enum values ('everyone', 'selected')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in assigned_groups (list) + _items = [] + if self.assigned_groups: + for _item_assigned_groups in self.assigned_groups: + if _item_assigned_groups: + _items.append(_item_assigned_groups.to_dict()) + _dict['assignedGroups'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in submissions (list) + _items = [] + if self.submissions: + for _item_submissions in self.submissions: + if _item_submissions: + _items.append(_item_submissions.to_dict()) + _dict['submissions'] = _items + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of mfc + if self.mfc: + _dict['mfc'] = self.mfc.to_dict() + # override the default output from pydantic by calling `to_dict()` of canvas + if self.canvas: + _dict['canvas'] = self.canvas.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "creator": obj.get("creator"), + "state": obj.get("state"), + "classroom": obj.get("classroom"), + "creationDate": obj.get("creationDate"), + "scheduledDate": obj.get("scheduledDate"), + "dueDate": obj.get("dueDate"), + "assigneeMode": obj.get("assigneeMode"), + "assignedStudents": obj.get("assignedStudents"), + "assignedGroups": [AssignmentGroup.from_dict(_item) for _item in obj["assignedGroups"]] if obj.get("assignedGroups") is not None else None, + "submissions": [AssignmentSubmission.from_dict(_item) for _item in obj["submissions"]] if obj.get("submissions") is not None else None, + "googleClassroom": GoogleClassroomCoursework.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": MicrosoftGraphAssignment.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "mfc": ClassAssignmentAllOfMfc.from_dict(obj["mfc"]) if obj.get("mfc") is not None else None, + "canvas": ClassAssignmentAllOfCanvas.from_dict(obj["canvas"]) if obj.get("canvas") is not None else None, + "lti": ClassAssignmentAllOfLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None, + "issue": obj.get("issue") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_all_of_canvas.py b/flat_api/aio/models/class_assignment_all_of_canvas.py new file mode 100644 index 0000000..89d5f23 --- /dev/null +++ b/flat_api/aio/models/class_assignment_all_of_canvas.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfCanvas(BaseModel): + """ + A Canvas LMS assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the assignment on Canvas") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to Canvas assignment", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfCanvas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfCanvas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_all_of_lti.py b/flat_api/aio/models/class_assignment_all_of_lti.py new file mode 100644 index 0000000..3a01e9a --- /dev/null +++ b/flat_api/aio/models/class_assignment_all_of_lti.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfLti(BaseModel): + """ + An LTI assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Resource ID in the LMS") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_all_of_mfc.py b/flat_api/aio/models/class_assignment_all_of_mfc.py new file mode 100644 index 0000000..32db1fe --- /dev/null +++ b/flat_api/aio/models/class_assignment_all_of_mfc.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfMfc(BaseModel): + """ + A MusicFirst Classroom assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the task on MusicFirst Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to MusicFirst Classroom task", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfMfc from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfMfc from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_update.py b/flat_api/aio/models/class_assignment_update.py new file mode 100644 index 0000000..92a4945 --- /dev/null +++ b/flat_api/aio/models/class_assignment_update.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.aio.models.assignment_type import AssignmentType +from flat_api.aio.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.aio.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph +from flat_api.aio.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdate(BaseModel): + """ + ClassAssignmentUpdate + """ # noqa: E501 + type: Optional[AssignmentType] = None + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the assignment") + description: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Teacher-only instructions (plain text)", alias="teacherInstructions") + teacher_instructions_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + attachments: Optional[List[ClassAttachmentCreation]] = Field(default=None, description="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`. ") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + toolset: Optional[StrictStr] = Field(default=None, description="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. ") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + max_points: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="If set, the grading will be enabled for the assignment with this value as the maximum of points ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + state: Optional[StrictStr] = Field(default=None, description="State of the assignment") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment, late submissions will be marked as past due. If not set, the assignment won't have a due date. ", alias="dueDate") + scheduled_date: Optional[datetime] = Field(default=None, description="The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. ", alias="scheduledDate") + google_classroom: Optional[ClassAssignmentUpdateAllOfGoogleClassroom] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[ClassAssignmentUpdateAllOfMicrosoftGraph] = Field(default=None, alias="microsoftGraph") + assignee_mode: Optional[StrictStr] = Field(default=None, description="Possible modes of assigning assignments", alias="assigneeMode") + assigned_students: Optional[List[StrictStr]] = Field(default=None, description="Identifiers for the students that have access to the assignment", alias="assignedStudents") + class_group_ids: Optional[List[StrictStr]] = Field(default=None, description="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 ", alias="classGroupIds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "attachments", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "toolset", "coverFile", "cover", "maxPoints", "releaseGrades", "shuffleExercises", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "state", "dueDate", "scheduledDate", "googleClassroom", "microsoftGraph", "assigneeMode", "assignedStudents", "classGroupIds"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['draft', 'active']): + raise ValueError("must be one of enum values ('draft', 'active')") + return value + + @field_validator('assignee_mode') + def assignee_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['everyone', 'selected']): + raise ValueError("must be one of enum values ('everyone', 'selected')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if due_date (nullable) is None + # and model_fields_set contains the field + if self.due_date is None and "due_date" in self.model_fields_set: + _dict['dueDate'] = None + + # set to None if scheduled_date (nullable) is None + # and model_fields_set contains the field + if self.scheduled_date is None and "scheduled_date" in self.model_fields_set: + _dict['scheduledDate'] = None + + # set to None if class_group_ids (nullable) is None + # and model_fields_set contains the field + if self.class_group_ids is None and "class_group_ids" in self.model_fields_set: + _dict['classGroupIds'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "toolset": obj.get("toolset"), + "coverFile": obj.get("coverFile"), + "cover": obj.get("cover"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "state": obj.get("state"), + "dueDate": obj.get("dueDate"), + "scheduledDate": obj.get("scheduledDate"), + "googleClassroom": ClassAssignmentUpdateAllOfGoogleClassroom.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": ClassAssignmentUpdateAllOfMicrosoftGraph.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "assigneeMode": obj.get("assigneeMode"), + "assignedStudents": obj.get("assignedStudents"), + "classGroupIds": obj.get("classGroupIds") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_update_all_of_google_classroom.py b/flat_api/aio/models/class_assignment_update_all_of_google_classroom.py new file mode 100644 index 0000000..4fe44c7 --- /dev/null +++ b/flat_api/aio/models/class_assignment_update_all_of_google_classroom.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdateAllOfGoogleClassroom(BaseModel): + """ + Google Classroom options for this assignment + """ # noqa: E501 + topic_id: Optional[StrictStr] = Field(default=None, description="Identifier of the topic where the assignment is created", alias="topicId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["topicId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if topic_id (nullable) is None + # and model_fields_set contains the field + if self.topic_id is None and "topic_id" in self.model_fields_set: + _dict['topicId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "topicId": obj.get("topicId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_assignment_update_all_of_microsoft_graph.py b/flat_api/aio/models/class_assignment_update_all_of_microsoft_graph.py new file mode 100644 index 0000000..7c6897d --- /dev/null +++ b/flat_api/aio/models/class_assignment_update_all_of_microsoft_graph.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdateAllOfMicrosoftGraph(BaseModel): + """ + Microsoft Graph options for this assignment + """ # noqa: E501 + categories: Optional[List[StrictStr]] = Field(default=None, description="List of categories this assignment belongs to") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["categories"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "categories": obj.get("categories") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_attachment_creation.py b/flat_api/aio/models/class_attachment_creation.py new file mode 100644 index 0000000..0b526dc --- /dev/null +++ b/flat_api/aio/models/class_attachment_creation.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.media_score_sharing_mode import MediaScoreSharingMode +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAttachmentCreation(BaseModel): + """ + Attachment creation for an assignment or stream post. This attachment must contain a `score` or a `url`; its details are resolved and returned as a `MediaAttachment` once the assignment or stream post is created. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="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. ") + score: Optional[StrictStr] = Field(default=None, description="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. ") + worksheet: Optional[StrictStr] = Field(default=None, description="A unique worksheet identifier") + revision: Optional[StrictStr] = Field(default=None, description="A unique revision identifier of a score") + part_uuid: Optional[StrictStr] = Field(default=None, description="The UUID of the instrument part selected for this attachment (for performance submissions)", alias="partUuid") + sharing_mode: Optional[MediaScoreSharingMode] = Field(default=MediaScoreSharingMode.READ, alias="sharingMode") + lock_score_template: Optional[StrictBool] = Field(default=None, description="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.", alias="lockScoreTemplate") + url: Optional[StrictStr] = Field(default=None, description="The URL of the attachment.") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="The ID of the Google Drive File", alias="googleDriveFileId") + teacher_only: Optional[StrictBool] = Field(default=False, description="Flag indicating if this attachment should only be visible to teachers", alias="teacherOnly") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "score", "worksheet", "revision", "partUuid", "sharingMode", "lockScoreTemplate", "url", "googleDriveFileId", "teacherOnly"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet']): + raise ValueError("must be one of enum values ('rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAttachmentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAttachmentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "score": obj.get("score"), + "worksheet": obj.get("worksheet"), + "revision": obj.get("revision"), + "partUuid": obj.get("partUuid"), + "sharingMode": obj.get("sharingMode") if obj.get("sharingMode") is not None else MediaScoreSharingMode.READ, + "lockScoreTemplate": obj.get("lockScoreTemplate"), + "url": obj.get("url"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "teacherOnly": obj.get("teacherOnly") if obj.get("teacherOnly") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_creation.py b/flat_api/aio/models/class_creation.py new file mode 100644 index 0000000..b34df8e --- /dev/null +++ b/flat_api/aio/models/class_creation.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.class_grade_level import ClassGradeLevel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassCreation(BaseModel): + """ + Creation of a classroom + """ # noqa: E501 + name: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The name of the new class") + section: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The section of the new class") + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "section", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "section": obj.get("section"), + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details.py b/flat_api/aio/models/class_details.py new file mode 100644 index 0000000..6efe838 --- /dev/null +++ b/flat_api/aio/models/class_details.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.class_details_canvas import ClassDetailsCanvas +from flat_api.aio.models.class_details_clever import ClassDetailsClever +from flat_api.aio.models.class_details_google_classroom import ClassDetailsGoogleClassroom +from flat_api.aio.models.class_details_google_drive import ClassDetailsGoogleDrive +from flat_api.aio.models.class_details_issues import ClassDetailsIssues +from flat_api.aio.models.class_details_lti import ClassDetailsLti +from flat_api.aio.models.class_details_mfc import ClassDetailsMfc +from flat_api.aio.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph +from flat_api.aio.models.class_grade_level import ClassGradeLevel +from flat_api.aio.models.class_state import ClassState +from flat_api.aio.models.group_details import GroupDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetails(BaseModel): + """ + A classroom + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the class") + state: ClassState + name: StrictStr = Field(description="The name of the class") + section: Optional[StrictStr] = Field(default=None, description="The section of the class") + description: Optional[StrictStr] = Field(default=None, description="An optional description for this class") + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization owning this class") + owner: Optional[StrictStr] = Field(default=None, description="The unique identifier of the User owning this class") + creation_date: datetime = Field(description="The date when the class was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date when the class was last modified", alias="modificationDate") + enrollment_code: Optional[StrictStr] = Field(default=None, description="[Teachers only] The enrollment code that can be used by the students to join the class ", alias="enrollmentCode") + theme: Optional[StrictStr] = Field(default=None, description="The theme identifier used in the Flat user interface") + assignments_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of assignments created in the class", alias="assignmentsCount") + students_group: Optional[GroupDetails] = Field(default=None, alias="studentsGroup") + teachers_group: Optional[GroupDetails] = Field(default=None, alias="teachersGroup") + issues: Optional[ClassDetailsIssues] = None + google_classroom: Optional[ClassDetailsGoogleClassroom] = Field(default=None, alias="googleClassroom") + google_drive: Optional[ClassDetailsGoogleDrive] = Field(default=None, alias="googleDrive") + microsoft_graph: Optional[ClassDetailsMicrosoftGraph] = Field(default=None, alias="microsoftGraph") + lti: Optional[ClassDetailsLti] = None + canvas: Optional[ClassDetailsCanvas] = None + mfc: Optional[ClassDetailsMfc] = None + clever: Optional[ClassDetailsClever] = None + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "name", "section", "description", "organization", "owner", "creationDate", "modificationDate", "enrollmentCode", "theme", "assignmentsCount", "studentsGroup", "teachersGroup", "issues", "googleClassroom", "googleDrive", "microsoftGraph", "lti", "canvas", "mfc", "clever", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of students_group + if self.students_group: + _dict['studentsGroup'] = self.students_group.to_dict() + # override the default output from pydantic by calling `to_dict()` of teachers_group + if self.teachers_group: + _dict['teachersGroup'] = self.teachers_group.to_dict() + # override the default output from pydantic by calling `to_dict()` of issues + if self.issues: + _dict['issues'] = self.issues.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # override the default output from pydantic by calling `to_dict()` of canvas + if self.canvas: + _dict['canvas'] = self.canvas.to_dict() + # override the default output from pydantic by calling `to_dict()` of mfc + if self.mfc: + _dict['mfc'] = self.mfc.to_dict() + # override the default output from pydantic by calling `to_dict()` of clever + if self.clever: + _dict['clever'] = self.clever.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "name": obj.get("name"), + "section": obj.get("section"), + "description": obj.get("description"), + "organization": obj.get("organization"), + "owner": obj.get("owner"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "enrollmentCode": obj.get("enrollmentCode"), + "theme": obj.get("theme"), + "assignmentsCount": obj.get("assignmentsCount"), + "studentsGroup": GroupDetails.from_dict(obj["studentsGroup"]) if obj.get("studentsGroup") is not None else None, + "teachersGroup": GroupDetails.from_dict(obj["teachersGroup"]) if obj.get("teachersGroup") is not None else None, + "issues": ClassDetailsIssues.from_dict(obj["issues"]) if obj.get("issues") is not None else None, + "googleClassroom": ClassDetailsGoogleClassroom.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "googleDrive": ClassDetailsGoogleDrive.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "microsoftGraph": ClassDetailsMicrosoftGraph.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "lti": ClassDetailsLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None, + "canvas": ClassDetailsCanvas.from_dict(obj["canvas"]) if obj.get("canvas") is not None else None, + "mfc": ClassDetailsMfc.from_dict(obj["mfc"]) if obj.get("mfc") is not None else None, + "clever": ClassDetailsClever.from_dict(obj["clever"]) if obj.get("clever") is not None else None, + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_canvas.py b/flat_api/aio/models/class_details_canvas.py new file mode 100644 index 0000000..7f218f3 --- /dev/null +++ b/flat_api/aio/models/class_details_canvas.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsCanvas(BaseModel): + """ + Meta information provided by Canvas LMS + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the course on Canvas") + domain: Optional[StrictStr] = Field(default=None, description="Canvas instance domain (e.g. \"canvas.instructure.com\")") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "domain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsCanvas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsCanvas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "domain": obj.get("domain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_clever.py b/flat_api/aio/models/class_details_clever.py new file mode 100644 index 0000000..23a8d78 --- /dev/null +++ b/flat_api/aio/models/class_details_clever.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsClever(BaseModel): + """ + Clever.com section-related information + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Clever section unique identifier") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the section on clever", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The last modification date of the section on clever", alias="modificationDate") + subject: Optional[StrictStr] = Field(default=None, description="Normalized subject of the course") + term_name: Optional[StrictStr] = Field(default=None, description="Name of the term when this course happens", alias="termName") + term_start_date: Optional[datetime] = Field(default=None, description="Beginning date of the term", alias="termStartDate") + term_end_date: Optional[datetime] = Field(default=None, description="End date of the term", alias="termEndDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creationDate", "modificationDate", "subject", "termName", "termStartDate", "termEndDate"] + + @field_validator('subject') + def subject_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['english/language arts', 'math', 'science', 'social studies', 'language', 'homeroom/advisory', 'interventions/online learning', 'technology and engineering', 'PE and health', 'arts and music', 'other']): + raise ValueError("must be one of enum values ('english/language arts', 'math', 'science', 'social studies', 'language', 'homeroom/advisory', 'interventions/online learning', 'technology and engineering', 'PE and health', 'arts and music', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsClever from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsClever from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "subject": obj.get("subject"), + "termName": obj.get("termName"), + "termStartDate": obj.get("termStartDate"), + "termEndDate": obj.get("termEndDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_google_classroom.py b/flat_api/aio/models/class_details_google_classroom.py new file mode 100644 index 0000000..2f0921a --- /dev/null +++ b/flat_api/aio/models/class_details_google_classroom.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsGoogleClassroom(BaseModel): + """ + Google Classroom course-related information + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The course identifier on Google Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this course in the Classroom web UI", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleClassroom from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleClassroom from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_google_drive.py b/flat_api/aio/models/class_details_google_drive.py new file mode 100644 index 0000000..06024f7 --- /dev/null +++ b/flat_api/aio/models/class_details_google_drive.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsGoogleDrive(BaseModel): + """ + Google Drive course-related information provided by Google Classroom + """ # noqa: E501 + teacher_folder_id: Optional[StrictStr] = Field(default=None, description="[Teachers only] The Drive directory identifier of the teachers' folder ", alias="teacherFolderId") + teacher_folder_alternate_link: Optional[StrictStr] = Field(default=None, description="[Teachers only] The Drive URL of the teachers' folder ", alias="teacherFolderAlternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["teacherFolderId", "teacherFolderAlternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleDrive from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleDrive from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "teacherFolderId": obj.get("teacherFolderId"), + "teacherFolderAlternateLink": obj.get("teacherFolderAlternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_issues.py b/flat_api/aio/models/class_details_issues.py new file mode 100644 index 0000000..4a33a72 --- /dev/null +++ b/flat_api/aio/models/class_details_issues.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsIssues(BaseModel): + """ + Detected issues for this class + """ # noqa: E501 + sync: Optional[List[ClassDetailsIssuesSyncInner]] = Field(default=None, description="Synchronization issues for the class") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sync"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsIssues from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sync (list) + _items = [] + if self.sync: + for _item_sync in self.sync: + if _item_sync: + _items.append(_item_sync.to_dict()) + _dict['sync'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsIssues from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sync": [ClassDetailsIssuesSyncInner.from_dict(_item) for _item in obj["sync"]] if obj.get("sync") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_issues_sync_inner.py b/flat_api/aio/models/class_details_issues_sync_inner.py new file mode 100644 index 0000000..b311472 --- /dev/null +++ b/flat_api/aio/models/class_details_issues_sync_inner.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsIssuesSyncInner(BaseModel): + """ + A sync issue + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The account user identifier") + email: Optional[StrictStr] = Field(default=None, description="The email address of the user concerned by this sync issue") + reason: Optional[StrictStr] = Field(default=None, description="The reason why the account cannot be synced") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "email", "reason"] + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['otherOrgnanization', 'productMigration', 'disabledAccount']): + raise ValueError("must be one of enum values ('otherOrgnanization', 'productMigration', 'disabledAccount')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsIssuesSyncInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsIssuesSyncInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "email": obj.get("email"), + "reason": obj.get("reason") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_lti.py b/flat_api/aio/models/class_details_lti.py new file mode 100644 index 0000000..cbd3ff3 --- /dev/null +++ b/flat_api/aio/models/class_details_lti.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsLti(BaseModel): + """ + Info about LTI context (1.1 and 1.3) + """ # noqa: E501 + context_id: Optional[StrictStr] = Field(default=None, description="Unique context identifier provided", alias="contextId") + context_title: Optional[StrictStr] = Field(default=None, description="Context title", alias="contextTitle") + context_label: Optional[StrictStr] = Field(default=None, description="Context label", alias="contextLabel") + has_nrps_service: Optional[StrictBool] = Field(default=None, description="If true, the class has been synchronized with the LTI 1.3 NRPS 2.0 service", alias="hasNrpsService") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["contextId", "contextTitle", "contextLabel", "hasNrpsService"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "contextId": obj.get("contextId"), + "contextTitle": obj.get("contextTitle"), + "contextLabel": obj.get("contextLabel"), + "hasNrpsService": obj.get("hasNrpsService") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_mfc.py b/flat_api/aio/models/class_details_mfc.py new file mode 100644 index 0000000..4d00904 --- /dev/null +++ b/flat_api/aio/models/class_details_mfc.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsMfc(BaseModel): + """ + Meta information provided by MusicFirst Classroom + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the course on MusicFirst Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to MusicFirst Classroom class", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsMfc from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsMfc from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_details_microsoft_graph.py b/flat_api/aio/models/class_details_microsoft_graph.py new file mode 100644 index 0000000..637d56d --- /dev/null +++ b/flat_api/aio/models/class_details_microsoft_graph.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsMicrosoftGraph(BaseModel): + """ + ClassDetailsMicrosoftGraph + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The course identifier on Microsoft Graph") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsMicrosoftGraph from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsMicrosoftGraph from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/class_grade_level.py b/flat_api/aio/models/class_grade_level.py new file mode 100644 index 0000000..093b5c8 --- /dev/null +++ b/flat_api/aio/models/class_grade_level.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ClassGradeLevel(str, Enum): + """ + Class grade level + """ + + """ + allowed enum values + """ + ELEMENTARY = 'elementary' + MIDDLE = 'middle' + HIGH = 'high' + UNIVERSITY = 'university' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassGradeLevel from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/class_roles.py b/flat_api/aio/models/class_roles.py new file mode 100644 index 0000000..e13d741 --- /dev/null +++ b/flat_api/aio/models/class_roles.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ClassRoles(str, Enum): + """ + User's Class Role (for Edu users only) + """ + + """ + allowed enum values + """ + TEACHER = 'teacher' + STUDENT = 'student' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassRoles from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/class_state.py b/flat_api/aio/models/class_state.py new file mode 100644 index 0000000..a7c3ed5 --- /dev/null +++ b/flat_api/aio/models/class_state.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ClassState(str, Enum): + """ + The state of a classroom + """ + + """ + allowed enum values + """ + ACTIVE = 'active' + INACTIVE = 'inactive' + ARCHIVED = 'archived' + DELETED = 'deleted' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/class_update.py b/flat_api/aio/models/class_update.py new file mode 100644 index 0000000..d747245 --- /dev/null +++ b/flat_api/aio/models/class_update.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.class_grade_level import ClassGradeLevel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassUpdate(BaseModel): + """ + Update of a classroom + """ # noqa: E501 + name: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The name of the class") + section: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The section of the class") + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "section", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "section": obj.get("section"), + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection.py b/flat_api/aio/models/collection.py new file mode 100644 index 0000000..8b68d7d --- /dev/null +++ b/flat_api/aio/models/collection.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.collection_app import CollectionApp +from flat_api.aio.models.collection_capabilities import CollectionCapabilities +from flat_api.aio.models.collection_contents import CollectionContents +from flat_api.aio.models.collection_privacy import CollectionPrivacy +from flat_api.aio.models.collection_type import CollectionType +from flat_api.aio.models.resource_collaborator import ResourceCollaborator +from flat_api.aio.models.resource_rights import ResourceRights +from flat_api.aio.models.user_public_summary import UserPublicSummary +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Collection(BaseModel): + """ + Collection of scores + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the collection") + title: StrictStr = Field(description="The title of the collection") + html_url: StrictStr = Field(description="The url where the collection can be viewed in a web browser", alias="htmlUrl") + type: CollectionType + label_key: Optional[StrictStr] = Field(default=None, description="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. ", alias="labelKey") + privacy: CollectionPrivacy + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + app: Optional[CollectionApp] = None + creation_date: datetime = Field(description="The date when the collection was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date when the collection was last modified", alias="modificationDate") + user: Optional[UserPublicSummary] = None + organization: Optional[StrictStr] = Field(default=None, description="If the score has been created in an organization, the identifier of this organization. ") + rights: Optional[ResourceRights] = None + collaborators: Optional[List[ResourceCollaborator]] = Field(default=None, description="The list of the collaborators of the collection") + is_pinned: Optional[StrictBool] = Field(default=None, description="Whether the collection is pinned by the owner", alias="isPinned") + contents: CollectionContents + capabilities: CollectionCapabilities + collections: Optional[List[StrictStr]] = Field(default=None, description="The list of parent collections this score is included in. Please note that you might not have access to all of them.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "htmlUrl", "type", "labelKey", "privacy", "sharingKey", "app", "creationDate", "modificationDate", "user", "organization", "rights", "collaborators", "isPinned", "contents", "capabilities", "collections"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Collection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of app + if self.app: + _dict['app'] = self.app.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of rights + if self.rights: + _dict['rights'] = self.rights.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collaborators (list) + _items = [] + if self.collaborators: + for _item_collaborators in self.collaborators: + if _item_collaborators: + _items.append(_item_collaborators.to_dict()) + _dict['collaborators'] = _items + # override the default output from pydantic by calling `to_dict()` of contents + if self.contents: + _dict['contents'] = self.contents.to_dict() + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Collection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "htmlUrl": obj.get("htmlUrl"), + "type": obj.get("type"), + "labelKey": obj.get("labelKey"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE, + "sharingKey": obj.get("sharingKey"), + "app": CollectionApp.from_dict(obj["app"]) if obj.get("app") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "user": UserPublicSummary.from_dict(obj["user"]) if obj.get("user") is not None else None, + "organization": obj.get("organization"), + "rights": ResourceRights.from_dict(obj["rights"]) if obj.get("rights") is not None else None, + "collaborators": [ResourceCollaborator.from_dict(_item) for _item in obj["collaborators"]] if obj.get("collaborators") is not None else None, + "isPinned": obj.get("isPinned"), + "contents": CollectionContents.from_dict(obj["contents"]) if obj.get("contents") is not None else None, + "capabilities": CollectionCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "collections": obj.get("collections") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_app.py b/flat_api/aio/models/collection_app.py new file mode 100644 index 0000000..e8888fb --- /dev/null +++ b/flat_api/aio/models/collection_app.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionApp(BaseModel): + """ + For App collections, the details of the app that created the collection + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The app unique identifier") + name: Optional[StrictStr] = Field(default=None, description="The name of the app") + logo: Optional[StrictStr] = Field(default=None, description="The app logo url") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "logo"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionApp from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionApp from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "logo": obj.get("logo") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_capabilities.py b/flat_api/aio/models/collection_capabilities.py new file mode 100644 index 0000000..62a3724 --- /dev/null +++ b/flat_api/aio/models/collection_capabilities.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionCapabilities(BaseModel): + """ + Capabilities the current user has on this collection. Each capability corresponds to a fine-grained action that a user may take. + """ # noqa: E501 + can_edit: StrictBool = Field(description="Whether the current user can modify the metadata for the collection ", alias="canEdit") + can_share: StrictBool = Field(description="Whether the current user can modify the sharing settings for the collection ", alias="canShare") + can_delete: StrictBool = Field(description="Whether the current user can delete the collection ", alias="canDelete") + can_add_scores: StrictBool = Field(description="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. ", alias="canAddScores") + can_delete_scores: StrictBool = Field(description="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. ", alias="canDeleteScores") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canShare", "canDelete", "canAddScores", "canDeleteScores"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canShare": obj.get("canShare"), + "canDelete": obj.get("canDelete"), + "canAddScores": obj.get("canAddScores"), + "canDeleteScores": obj.get("canDeleteScores") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_contents.py b/flat_api/aio/models/collection_contents.py new file mode 100644 index 0000000..f209849 --- /dev/null +++ b/flat_api/aio/models/collection_contents.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionContents(BaseModel): + """ + The contents of the collection + """ # noqa: E501 + scores_count: StrictInt = Field(description="The number of scores in the collection", alias="scoresCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scoresCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionContents from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionContents from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scoresCount": obj.get("scoresCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_creation.py b/flat_api/aio/models/collection_creation.py new file mode 100644 index 0000000..19a4557 --- /dev/null +++ b/flat_api/aio/models/collection_creation.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.collection_privacy import CollectionPrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionCreation(BaseModel): + """ + CollectionCreation + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="The title of the collection") + privacy: Optional[CollectionPrivacy] = CollectionPrivacy.PRIVATE + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_modification.py b/flat_api/aio/models/collection_modification.py new file mode 100644 index 0000000..dfb3a76 --- /dev/null +++ b/flat_api/aio/models/collection_modification.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.collection_privacy import CollectionPrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionModification(BaseModel): + """ + Edit the collection metadata + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="The title of the collection") + privacy: Optional[CollectionPrivacy] = CollectionPrivacy.PRIVATE + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionModification from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionModification from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/collection_privacy.py b/flat_api/aio/models/collection_privacy.py new file mode 100644 index 0000000..daac96e --- /dev/null +++ b/flat_api/aio/models/collection_privacy.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class CollectionPrivacy(str, Enum): + """ + The collection main privacy mode. - `private`: The collection is private and can only be accessed, modified, and administered by specified collaborators. + """ + + """ + allowed enum values + """ + PRIVATE = 'private' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CollectionPrivacy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/collection_type.py b/flat_api/aio/models/collection_type.py new file mode 100644 index 0000000..170f57d --- /dev/null +++ b/flat_api/aio/models/collection_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class CollectionType(str, Enum): + """ + Type of the collection. The type will influence the capabilities available on the collections and how this collection is/can be populated. - `root`: **Deprecated.** Previously the root collection of the user. The `allScores` virtual collection should be used instead. - `regular`: A regular collection created by the user. This collection can be deleted and modified by the user. - `app`: An automatically created collection containing the scores created by an app (e.g. Music Snippet) - `trash`: An automatically created collection containing the trashed scores. Virtual collections: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores + """ + + """ + allowed enum values + """ + ROOT = 'root' + REGULAR = 'regular' + APP = 'app' + TRASH = 'trash' + ALLSCORES = 'allScores' + COLLABORATIONS = 'collaborations' + LIKES = 'likes' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CollectionType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/credit_transaction.py b/flat_api/aio/models/credit_transaction.py new file mode 100644 index 0000000..a346f0c --- /dev/null +++ b/flat_api/aio/models/credit_transaction.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CreditTransaction(BaseModel): + """ + A single credit ledger entry + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the credit transaction") + type: StrictStr = Field(description="Credit category. `ai` covers every AI-powered feature.") + feature: Optional[StrictStr] = Field(default=None, description="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. ") + amount: StrictInt = Field(description="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: StrictStr = Field(description="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: StrictStr = Field(description="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: Optional[StrictStr] = Field(default=None, description="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. ") + creation_date: datetime = Field(description="When the transaction was created", alias="creationDate") + modification_date: datetime = Field(description="When the transaction was last modified", alias="modificationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "feature", "amount", "source", "state", "job", "creationDate", "modificationDate"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ai']): + raise ValueError("must be one of enum values ('ai')") + return value + + @field_validator('feature') + def feature_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['omr']): + raise ValueError("must be one of enum values ('omr')") + return value + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['subscription', 'purchase', 'free_tier', 'support']): + raise ValueError("must be one of enum values ('subscription', 'purchase', 'free_tier', 'support')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['active', 'canceled']): + raise ValueError("must be one of enum values ('active', 'canceled')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreditTransaction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreditTransaction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "feature": obj.get("feature"), + "amount": obj.get("amount"), + "source": obj.get("source"), + "state": obj.get("state"), + "job": obj.get("job"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_library.py b/flat_api/aio/models/edu_library.py new file mode 100644 index 0000000..fc5cded --- /dev/null +++ b/flat_api/aio/models/edu_library.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduLibrary(BaseModel): + """ + A Flat for Education Library + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the library. This one can be used to list the underlying resources using `GET /v2/eduResources?parent={library-id}` ") + name: StrictStr = Field(description="Name of the library") + type: StrictStr = Field(description="Type of the library") + visibility: StrictStr = Field(description="Visibility of the library") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "visibility"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['myResources', 'organizationResources', 'flatEduContent']): + raise ValueError("must be one of enum values ('myResources', 'organizationResources', 'flatEduContent')") + return value + + @field_validator('visibility') + def visibility_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['private', 'organization', 'public']): + raise ValueError("must be one of enum values ('private', 'organization', 'public')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduLibrary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduLibrary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "visibility": obj.get("visibility") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource.py b/flat_api/aio/models/edu_resource.py new file mode 100644 index 0000000..3ccab75 --- /dev/null +++ b/flat_api/aio/models/edu_resource.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.edu_resource_capabilities import EduResourceCapabilities +from flat_api.aio.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.aio.models.edu_resource_resource import EduResourceResource +from flat_api.aio.models.edu_resource_type import EduResourceType +from flat_api.aio.models.grade import Grade +from flat_api.aio.models.teaching_theme import TeachingTheme +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResource(BaseModel): + """ + A Flat for Education resource contained in a resources library + """ # noqa: E501 + id: StrictStr = Field(description="Resource unique identifier") + creator: Optional[StrictStr] = Field(default=None, description="The User identifier of the resource creator") + type: EduResourceType + privacy: Optional[EduResourcePrivacy] = EduResourcePrivacy.PRIVATE + tags: Optional[List[StrictStr]] = Field(default=None, description="Specific attributes for the resource (e.g. sample resources with custom design)") + parent: Optional[StrictStr] = Field(default=None, description="Identifier of the parent resource, e.g. a folder or root") + title: StrictStr = Field(description="Title of the resource") + sharing_description: Optional[StrictStr] = Field(default=None, description="Sharing description of this resource", alias="sharingDescription") + sharing_description_html: Optional[StrictStr] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + creation_date: Optional[datetime] = Field(default=None, description="The date when the resource was created", alias="creationDate") + update_date: Optional[datetime] = Field(default=None, description="The date when the resource was updated", alias="updateDate") + resource: Optional[EduResourceResource] = None + capabilities: EduResourceCapabilities + subjects: Optional[List[TeachingTheme]] = Field(default=None, description="The subjects of this resource, or the subjects of the resources included in the folder") + grades: Optional[List[Grade]] = Field(default=None, description="The grades of this resource, or the grades of the resources included in the folder.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creator", "type", "privacy", "tags", "parent", "title", "sharingDescription", "sharingDescriptionHtml", "creationDate", "updateDate", "resource", "capabilities", "subjects", "grades"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResource from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of resource + if self.resource: + _dict['resource'] = self.resource.to_dict() + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creator": obj.get("creator"), + "type": obj.get("type"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else EduResourcePrivacy.PRIVATE, + "tags": obj.get("tags"), + "parent": obj.get("parent"), + "title": obj.get("title"), + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "creationDate": obj.get("creationDate"), + "updateDate": obj.get("updateDate"), + "resource": EduResourceResource.from_dict(obj["resource"]) if obj.get("resource") is not None else None, + "capabilities": EduResourceCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "subjects": obj.get("subjects"), + "grades": obj.get("grades") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_assignment_creation.py b/flat_api/aio/models/edu_resource_assignment_creation.py new file mode 100644 index 0000000..acca35c --- /dev/null +++ b/flat_api/aio/models/edu_resource_assignment_creation.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.assignment_type import AssignmentType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceAssignmentCreation(BaseModel): + """ + Assignment-specific creation options. Only applicable when creating a resource with `type: assignment`. If `type` is not provided, defaults to `none`. + """ # noqa: E501 + type: Optional[AssignmentType] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceAssignmentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceAssignmentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_capabilities.py b/flat_api/aio/models/edu_resource_capabilities.py new file mode 100644 index 0000000..2908470 --- /dev/null +++ b/flat_api/aio/models/edu_resource_capabilities.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCapabilities(BaseModel): + """ + Capabilities available for this resource + """ # noqa: E501 + can_edit: Optional[StrictBool] = Field(default=None, description="Whether the current user can modify this resource ", alias="canEdit") + can_add_resources: Optional[StrictBool] = Field(default=None, description="Whether the current user can add resources within this resource (e.g. `assignment` inside a `folder`) ", alias="canAddResources") + can_add_folders: Optional[StrictBool] = Field(default=None, description="Whether the current user can add folders within this resource (e.g. `folder` inside `root`) ", alias="canAddFolders") + can_change_privacy: Optional[StrictBool] = Field(default=None, description="Whether the current user can change the privacy of this resource (e.g. to share as `organizationPublic` or unshare it with `private`) ", alias="canChangePrivacy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canAddResources", "canAddFolders", "canChangePrivacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canAddResources": obj.get("canAddResources"), + "canAddFolders": obj.get("canAddFolders"), + "canChangePrivacy": obj.get("canChangePrivacy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_copy.py b/flat_api/aio/models/edu_resource_copy.py new file mode 100644 index 0000000..c4a4278 --- /dev/null +++ b/flat_api/aio/models/edu_resource_copy.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCopy(BaseModel): + """ + Copy an education resource + """ # noqa: E501 + destination: StrictStr = Field(description="Unique identifier of the destination folder for the copy. This can also be `root` to copy the resource at the root of the user resource library. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCopy from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCopy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_creation.py b/flat_api/aio/models/edu_resource_creation.py new file mode 100644 index 0000000..5ea589f --- /dev/null +++ b/flat_api/aio/models/edu_resource_creation.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.edu_resource_assignment_creation import EduResourceAssignmentCreation +from flat_api.aio.models.edu_resource_type import EduResourceType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCreation(BaseModel): + """ + Creation of an education resource + """ # noqa: E501 + type: EduResourceType + title: Annotated[str, Field(min_length=1, strict=True, max_length=1000)] = Field(description="Title of the resource") + parent: Optional[StrictStr] = Field(default='root', description="Identifier of the parent resource where the new one will be created, e.g. a folder id or `root`") + sharing_description: Optional[Annotated[str, Field(strict=True, max_length=400)]] = Field(default=None, description="Sharing description of the resource", alias="sharingDescription") + sharing_description_html: Optional[Annotated[str, Field(strict=True, max_length=10000)]] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + resource: Optional[EduResourceAssignmentCreation] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "parent", "sharingDescription", "sharingDescriptionHtml", "resource"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of resource + if self.resource: + _dict['resource'] = self.resource.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "parent": obj.get("parent") if obj.get("parent") is not None else 'root', + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "resource": EduResourceAssignmentCreation.from_dict(obj["resource"]) if obj.get("resource") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_folder.py b/flat_api/aio/models/edu_resource_folder.py new file mode 100644 index 0000000..637af48 --- /dev/null +++ b/flat_api/aio/models/edu_resource_folder.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.assignment_type import AssignmentType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceFolder(BaseModel): + """ + Education resources folder + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the folder") + assignments_types: Optional[List[AssignmentType]] = Field(default=None, description="The assignment types of the resources included in the folder", alias="assignmentsTypes") + resources_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of resources inside the folder", alias="resourcesCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "assignmentsTypes", "resourcesCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceFolder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceFolder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "assignmentsTypes": obj.get("assignmentsTypes"), + "resourcesCount": obj.get("resourcesCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_lti_link.py b/flat_api/aio/models/edu_resource_lti_link.py new file mode 100644 index 0000000..c946422 --- /dev/null +++ b/flat_api/aio/models/edu_resource_lti_link.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceLtiLink(BaseModel): + """ + LTI Link details for the class + """ # noqa: E501 + lti_url: StrictStr = Field(description="A URL that can be used to launch LTI with this resource in a classroom.", alias="ltiUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ltiUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceLtiLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceLtiLink from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ltiUrl": obj.get("ltiUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_move.py b/flat_api/aio/models/edu_resource_move.py new file mode 100644 index 0000000..f622df6 --- /dev/null +++ b/flat_api/aio/models/edu_resource_move.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceMove(BaseModel): + """ + Move an education resource + """ # noqa: E501 + destination: StrictStr = Field(description="Unique identifier of the destination folder for this resource. This can also be `root` to move the resource at the root of the user resource library. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceMove from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceMove from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_privacy.py b/flat_api/aio/models/edu_resource_privacy.py new file mode 100644 index 0000000..b808c3e --- /dev/null +++ b/flat_api/aio/models/edu_resource_privacy.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EduResourcePrivacy(str, Enum): + """ + The Education resource privacy mode. + """ + + """ + allowed enum values + """ + PRIVATE = 'private' + ORGANIZATIONPUBLIC = 'organizationPublic' + PUBLIC = 'public' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EduResourcePrivacy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/edu_resource_resource.py b/flat_api/aio/models/edu_resource_resource.py new file mode 100644 index 0000000..35e4d29 --- /dev/null +++ b/flat_api/aio/models/edu_resource_resource.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.assignment import Assignment +from flat_api.aio.models.edu_resource_folder import EduResourceFolder +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +EDURESOURCERESOURCE_ONE_OF_SCHEMAS = ["Assignment", "EduResourceFolder"] + +class EduResourceResource(BaseModel): + """ + EduResourceResource + """ + # data type: Assignment + oneof_schema_1_validator: Optional[Assignment] = None + # data type: EduResourceFolder + oneof_schema_2_validator: Optional[EduResourceFolder] = None + actual_instance: Optional[Union[Assignment, EduResourceFolder]] = None + one_of_schemas: Set[str] = { "Assignment", "EduResourceFolder" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = EduResourceResource.model_construct() + error_messages = [] + match = 0 + # validate data type: Assignment + if not isinstance(v, Assignment): + error_messages.append(f"Error! Input type `{type(v)}` is not `Assignment`") + else: + match += 1 + # validate data type: EduResourceFolder + if not isinstance(v, EduResourceFolder): + error_messages.append(f"Error! Input type `{type(v)}` is not `EduResourceFolder`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into Assignment + try: + instance.actual_instance = Assignment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into EduResourceFolder + try: + instance.actual_instance = EduResourceFolder.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], Assignment, EduResourceFolder]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/edu_resource_type.py b/flat_api/aio/models/edu_resource_type.py new file mode 100644 index 0000000..1a8e0e4 --- /dev/null +++ b/flat_api/aio/models/edu_resource_type.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EduResourceType(str, Enum): + """ + Type of an education resource + """ + + """ + allowed enum values + """ + ASSIGNMENT = 'assignment' + FOLDER = 'folder' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EduResourceType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/edu_resource_update.py b/flat_api/aio/models/edu_resource_update.py new file mode 100644 index 0000000..cfcebda --- /dev/null +++ b/flat_api/aio/models/edu_resource_update.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.aio.models.grade import Grade +from flat_api.aio.models.teaching_theme import TeachingTheme +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceUpdate(BaseModel): + """ + Update of an education resource + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the resource") + sharing_description: Optional[Annotated[str, Field(strict=True, max_length=400)]] = Field(default=None, description="Sharing description of the resource", alias="sharingDescription") + sharing_description_html: Optional[Annotated[str, Field(strict=True, max_length=10000)]] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + privacy: Optional[EduResourcePrivacy] = EduResourcePrivacy.PRIVATE + subjects: Optional[List[TeachingTheme]] = Field(default=None, description="The subjects of this resource, or the subjects of the resources included in the folder") + grades: Optional[List[Grade]] = Field(default=None, description="The grades of this resource, or the grades of the resources included in the folder.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "sharingDescription", "sharingDescriptionHtml", "privacy", "subjects", "grades"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else EduResourcePrivacy.PRIVATE, + "subjects": obj.get("subjects"), + "grades": obj.get("grades") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/edu_resource_use_in_class.py b/flat_api/aio/models/edu_resource_use_in_class.py new file mode 100644 index 0000000..b63a5d6 --- /dev/null +++ b/flat_api/aio/models/edu_resource_use_in_class.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceUseInClass(BaseModel): + """ + Use an education resource in class + """ # noqa: E501 + classroom: StrictStr = Field(description="The destination classroom where the resource will be copied.") + assignment: Optional[StrictStr] = Field(default=None, description="An optional destination assignment where the original assignment will be copied. Must be a draft.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["classroom", "assignment"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceUseInClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceUseInClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/flat_error_response.py b/flat_api/aio/models/flat_error_response.py new file mode 100644 index 0000000..92cbab6 --- /dev/null +++ b/flat_api/aio/models/flat_error_response.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FlatErrorResponse(BaseModel): + """ + An API Error response + """ # noqa: E501 + code: StrictStr = Field(description="A corresponding code for this error") + message: StrictStr = Field(description="A printable message for this error") + id: Optional[StrictStr] = Field(default=None, description="A unique error identifier generated for the request") + param: Optional[StrictStr] = Field(default=None, description="The related parameter that caused the error") + provider_message: Optional[StrictStr] = Field(default=None, description="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. ", alias="providerMessage") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "id", "param", "providerMessage"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FlatErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FlatErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "id": obj.get("id"), + "param": obj.get("param"), + "providerMessage": obj.get("providerMessage") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/google_classroom_coursework.py b/flat_api/aio/models/google_classroom_coursework.py new file mode 100644 index 0000000..6b9d252 --- /dev/null +++ b/flat_api/aio/models/google_classroom_coursework.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleClassroomCoursework(BaseModel): + """ + A coursework on Google Classroom + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifier of the coursework assigned by Classroom") + state: Optional[StrictStr] = Field(default=None, description="State of the coursework") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this coursework in the Classroom web UI", alias="alternateLink") + topic_id: Optional[StrictStr] = Field(default=None, description="Identifier of the topic where the assignment is created", alias="topicId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink", "topicId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleClassroomCoursework from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if topic_id (nullable) is None + # and model_fields_set contains the field + if self.topic_id is None and "topic_id" in self.model_fields_set: + _dict['topicId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleClassroomCoursework from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink"), + "topicId": obj.get("topicId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/google_classroom_submission.py b/flat_api/aio/models/google_classroom_submission.py new file mode 100644 index 0000000..135982a --- /dev/null +++ b/flat_api/aio/models/google_classroom_submission.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleClassroomSubmission(BaseModel): + """ + A coursework submission on Google Classroom + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of the coursework submission assigned by Classroom") + state: StrictStr = Field(description="State of the submission on Google Classroom") + alternate_link: StrictStr = Field(description="Absolute link to this coursework in the Classroom web UI", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleClassroomSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleClassroomSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/grade.py b/flat_api/aio/models/grade.py new file mode 100644 index 0000000..f23960f --- /dev/null +++ b/flat_api/aio/models/grade.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Grade(str, Enum): + """ + Class grade of the resource + """ + + """ + allowed enum values + """ + ENUM_1 = '1' + ENUM_2 = '2' + ENUM_3 = '3' + ENUM_4 = '4' + ENUM_5 = '5' + ENUM_6 = '6' + ENUM_7 = '7' + ENUM_8 = '8' + ENUM_9 = '9' + ENUM_10 = '10' + ENUM_11 = '11' + ENUM_12 = '12' + UNIVERSITY = 'university' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Grade from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/group.py b/flat_api/aio/models/group.py new file mode 100644 index 0000000..7e360d1 --- /dev/null +++ b/flat_api/aio/models/group.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.group_type import GroupType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Group(BaseModel): + """ + A group of users + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of the group") + name: Optional[StrictStr] = Field(default=None, description="The display name of the group") + type: Optional[GroupType] = None + users_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of users in this group", alias="usersCount") + read_only: Optional[StrictBool] = Field(default=None, description="`True` if the group is set in read-only ", alias="readOnly") + organization: Optional[StrictStr] = Field(default=None, description="If the group is related to an organization, this field will contain the unique identifier of the organization ") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the group", alias="creationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "usersCount", "readOnly", "organization", "creationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Group from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Group from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "usersCount": obj.get("usersCount"), + "readOnly": obj.get("readOnly"), + "organization": obj.get("organization"), + "creationDate": obj.get("creationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/group_creation.py b/flat_api/aio/models/group_creation.py new file mode 100644 index 0000000..b7eb08d --- /dev/null +++ b/flat_api/aio/models/group_creation.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GroupCreation(BaseModel): + """ + GroupCreation + """ # noqa: E501 + type: StrictStr = Field(description="Type of group (currently only classStudentsSubGroup is supported)") + classroom: StrictStr = Field(description="Classroom ID") + name: Optional[StrictStr] = Field(default=None, description="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`. ") + members: Optional[List[StrictStr]] = Field(default=None, description="Array of student IDs to add to the group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "classroom", "name", "members"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['classStudentsSubGroup']): + raise ValueError("must be one of enum values ('classStudentsSubGroup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "classroom": obj.get("classroom"), + "name": obj.get("name"), + "members": obj.get("members") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/group_details.py b/flat_api/aio/models/group_details.py new file mode 100644 index 0000000..3c67234 --- /dev/null +++ b/flat_api/aio/models/group_details.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.group_type import GroupType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GroupDetails(BaseModel): + """ + The details of a group + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the group") + name: StrictStr = Field(description="The displayable name of the group") + type: GroupType + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization owning the group") + classroom: Optional[StrictStr] = Field(default=None, description="The unique identifier of the classroom owning the group. Only available for groups of type 'classStudentsSubGroup' or 'assignmentStudentsSubGroup'") + assignment: Optional[StrictStr] = Field(default=None, description="The unique identifier of the assignment owning the group. Only available for groups of type 'assignmentStudentsSubGroup'.") + parent: Optional[StrictStr] = Field(default=None, description="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.") + creation_date: datetime = Field(description="The date when the group was created", alias="creationDate") + users_count: Union[StrictFloat, StrictInt] = Field(description="The number of students in this group", alias="usersCount") + read_only: StrictBool = Field(description="`true` if the properties and members of this group are read-only ", alias="readOnly") + tags: List[StrictStr] = Field(description="Tags for categorizing groups. * `edu:testing-students`: Marks this group as containing test student accounts ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "organization", "classroom", "assignment", "parent", "creationDate", "usersCount", "readOnly", "tags"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "organization": obj.get("organization"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "parent": obj.get("parent"), + "creationDate": obj.get("creationDate"), + "usersCount": obj.get("usersCount"), + "readOnly": obj.get("readOnly"), + "tags": obj.get("tags") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/group_type.py b/flat_api/aio/models/group_type.py new file mode 100644 index 0000000..5b6f4c1 --- /dev/null +++ b/flat_api/aio/models/group_type.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class GroupType(str, Enum): + """ + The type of the group: * `generic`: A group created by a Flat user * `classTeachers`: A group created automatically by Flat that contains the teachers of a class * `classStudents`: A group created automatically by Flat that contains the students of a class * `classStudentsSubGroup`: Manually created sub-group of students of a class. * `assignmentStudentsSubGroup`: Manually created Sub-group of students of a class, in relation to a specific assignment. + """ + + """ + allowed enum values + """ + GENERIC = 'generic' + CLASSTEACHERS = 'classTeachers' + CLASSSTUDENTS = 'classStudents' + CLASSSTUDENTSSUBGROUP = 'classStudentsSubGroup' + ASSIGNMENTSTUDENTSSUBGROUP = 'assignmentStudentsSubGroup' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of GroupType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/license_mode.py b/flat_api/aio/models/license_mode.py new file mode 100644 index 0000000..33a7ae8 --- /dev/null +++ b/flat_api/aio/models/license_mode.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LicenseMode(str, Enum): + """ + Mode of the license + """ + + """ + allowed enum values + """ + CREDIT = 'credit' + SITE = 'site' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LicenseMode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/license_sources.py b/flat_api/aio/models/license_sources.py new file mode 100644 index 0000000..39e7617 --- /dev/null +++ b/flat_api/aio/models/license_sources.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LicenseSources(str, Enum): + """ + Source of the license + """ + + """ + allowed enum values + """ + ORDER = 'order' + TRIAL = 'trial' + VOUCHER = 'voucher' + DISTRIBUTOR = 'distributor' + SUBSCRIPTION = 'subscription' + APPSTORE = 'appStore' + PLAYSTORE = 'playStore' + MUSICFIRST = 'musicfirst' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LicenseSources from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/lms_name.py b/flat_api/aio/models/lms_name.py new file mode 100644 index 0000000..8c00a92 --- /dev/null +++ b/flat_api/aio/models/lms_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LmsName(str, Enum): + """ + LMS name + """ + + """ + allowed enum values + """ + CANVAS = 'canvas' + MOODLE = 'moodle' + SCHOOLOGY = 'schoology' + BLACKBOARD = 'blackboard' + DESIRE2LEARN = 'desire2learn' + SAKAI = 'sakai' + SCHOOLBOX = 'schoolbox' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LmsName from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/lti_configuration.py b/flat_api/aio/models/lti_configuration.py new file mode 100644 index 0000000..1475950 --- /dev/null +++ b/flat_api/aio/models/lti_configuration.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.lti_configuration1p1 import LtiConfiguration1p1 +from flat_api.aio.models.lti_configuration1p3 import LtiConfiguration1p3 +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATION_ONE_OF_SCHEMAS = ["LtiConfiguration1p1", "LtiConfiguration1p3"] + +class LtiConfiguration(BaseModel): + """ + LTI configuration details (unified 1.1 and 1.3) + """ + # data type: LtiConfiguration1p1 + oneof_schema_1_validator: Optional[LtiConfiguration1p1] = None + # data type: LtiConfiguration1p3 + oneof_schema_2_validator: Optional[LtiConfiguration1p3] = None + actual_instance: Optional[Union[LtiConfiguration1p1, LtiConfiguration1p3]] = None + one_of_schemas: Set[str] = { "LtiConfiguration1p1", "LtiConfiguration1p3" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfiguration.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfiguration1p1 + if not isinstance(v, LtiConfiguration1p1): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p1`") + else: + match += 1 + # validate data type: LtiConfiguration1p3 + if not isinstance(v, LtiConfiguration1p3): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfiguration1p1 + try: + instance.actual_instance = LtiConfiguration1p1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3 + try: + instance.actual_instance = LtiConfiguration1p3.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfiguration1p1, LtiConfiguration1p3]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/lti_configuration1p1.py b/flat_api/aio/models/lti_configuration1p1.py new file mode 100644 index 0000000..611b8a9 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p1.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p1(BaseModel): + """ + LtiConfiguration1p1 + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.1)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + consumer_key: Optional[StrictStr] = Field(default=None, description="LTI 1.1 consumer key", alias="consumerKey") + consumer_secret: Optional[StrictStr] = Field(default=None, description="LTI 1.1 consumer secret (only included for admins)", alias="consumerSecret") + lms: Optional[StrictStr] = Field(default=None, description="LMS type") + name: Optional[StrictStr] = Field(default=None, description="Configuration name") + tool: Optional[LtiConfiguration1p1AllOfTool] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "consumerKey", "consumerSecret", "lms", "name", "tool"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1']): + raise ValueError("must be one of enum values ('1p1')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "consumerKey": obj.get("consumerKey"), + "consumerSecret": obj.get("consumerSecret"), + "lms": obj.get("lms"), + "name": obj.get("name"), + "tool": LtiConfiguration1p1AllOfTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p1_all_of_tool.py b/flat_api/aio/models/lti_configuration1p1_all_of_tool.py new file mode 100644 index 0000000..bc9fe46 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p1_all_of_tool.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p1AllOfTool(BaseModel): + """ + Platform/tool product information + """ # noqa: E501 + product: Optional[StrictStr] = Field(default=None, description="Product family code (e.g., canvas, moodle, schoology)") + version: Optional[StrictStr] = Field(default=None, description="Platform version string") + instance_name: Optional[StrictStr] = Field(default=None, description="Instance display name", alias="instanceName") + instance_guid: Optional[StrictStr] = Field(default=None, description="Unique instance identifier", alias="instanceGuid") + instance_contact: Optional[StrictStr] = Field(default=None, description="Contact email or handle for the instance", alias="instanceContact") + instance_domain: Optional[StrictStr] = Field(default=None, description="Instance root domain", alias="instanceDomain") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["product", "version", "instanceName", "instanceGuid", "instanceContact", "instanceDomain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1AllOfTool from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1AllOfTool from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "product": obj.get("product"), + "version": obj.get("version"), + "instanceName": obj.get("instanceName"), + "instanceGuid": obj.get("instanceGuid"), + "instanceContact": obj.get("instanceContact"), + "instanceDomain": obj.get("instanceDomain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3.py b/flat_api/aio/models/lti_configuration1p3.py new file mode 100644 index 0000000..253fb53 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment +from flat_api.aio.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic +from flat_api.aio.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATION1P3_ONE_OF_SCHEMAS = ["LtiConfiguration1p3Deployment", "LtiConfiguration1p3Dynamic", "LtiConfiguration1p3Manual"] + +class LtiConfiguration1p3(BaseModel): + """ + LTI 1.3 configuration details + """ + # data type: LtiConfiguration1p3Manual + oneof_schema_1_validator: Optional[LtiConfiguration1p3Manual] = None + # data type: LtiConfiguration1p3Deployment + oneof_schema_2_validator: Optional[LtiConfiguration1p3Deployment] = None + # data type: LtiConfiguration1p3Dynamic + oneof_schema_3_validator: Optional[LtiConfiguration1p3Dynamic] = None + actual_instance: Optional[Union[LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual]] = None + one_of_schemas: Set[str] = { "LtiConfiguration1p3Deployment", "LtiConfiguration1p3Dynamic", "LtiConfiguration1p3Manual" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfiguration1p3.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfiguration1p3Manual + if not isinstance(v, LtiConfiguration1p3Manual): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Manual`") + else: + match += 1 + # validate data type: LtiConfiguration1p3Deployment + if not isinstance(v, LtiConfiguration1p3Deployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Deployment`") + else: + match += 1 + # validate data type: LtiConfiguration1p3Dynamic + if not isinstance(v, LtiConfiguration1p3Dynamic): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Dynamic`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfiguration1p3Manual + try: + instance.actual_instance = LtiConfiguration1p3Manual.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3Deployment + try: + instance.actual_instance = LtiConfiguration1p3Deployment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3Dynamic + try: + instance.actual_instance = LtiConfiguration1p3Dynamic.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/lti_configuration1p3_base.py b/flat_api/aio/models/lti_configuration1p3_base.py new file mode 100644 index 0000000..8d680b2 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base.py @@ -0,0 +1,158 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Base(BaseModel): + """ + LtiConfiguration1p3Base + """ # noqa: E501 + mode: Optional[StrictStr] = Field(default=None, description="LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-manual', '1p3-deployment', '1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-manual', '1p3-deployment', '1p3-dynamic')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Base from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Base from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_base_supported_services.py b/flat_api/aio/models/lti_configuration1p3_base_supported_services.py new file mode 100644 index 0000000..81e9fa6 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base_supported_services.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.aio.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.aio.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServices(BaseModel): + """ + LTI services support information + """ # noqa: E501 + ags: Optional[LtiConfiguration1p3BaseSupportedServicesAgs] = None + nrps: Optional[LtiConfiguration1p3BaseSupportedServicesNrps] = None + deep_linking: Optional[LtiConfiguration1p3BaseSupportedServicesDeepLinking] = Field(default=None, alias="deepLinking") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ags", "nrps", "deepLinking"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServices from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ags + if self.ags: + _dict['ags'] = self.ags.to_dict() + # override the default output from pydantic by calling `to_dict()` of nrps + if self.nrps: + _dict['nrps'] = self.nrps.to_dict() + # override the default output from pydantic by calling `to_dict()` of deep_linking + if self.deep_linking: + _dict['deepLinking'] = self.deep_linking.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServices from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ags": LtiConfiguration1p3BaseSupportedServicesAgs.from_dict(obj["ags"]) if obj.get("ags") is not None else None, + "nrps": LtiConfiguration1p3BaseSupportedServicesNrps.from_dict(obj["nrps"]) if obj.get("nrps") is not None else None, + "deepLinking": LtiConfiguration1p3BaseSupportedServicesDeepLinking.from_dict(obj["deepLinking"]) if obj.get("deepLinking") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_base_supported_services_ags.py b/flat_api/aio/models/lti_configuration1p3_base_supported_services_ags.py new file mode 100644 index 0000000..644a272 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base_supported_services_ags.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesAgs(BaseModel): + """ + Assignment and Grade Services support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether AGS claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="AGS version supported (e.g., \"2.0\")") + enabled: Optional[StrictBool] = Field(default=None, description="Whether AGS is enabled for this platform") + lineitems_url: Optional[StrictStr] = Field(default=None, description="Base URL for line items operations as provided by the platform", alias="lineitemsUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version", "enabled", "lineitemsUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version"), + "enabled": obj.get("enabled"), + "lineitemsUrl": obj.get("lineitemsUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_base_supported_services_deep_linking.py b/flat_api/aio/models/lti_configuration1p3_base_supported_services_deep_linking.py new file mode 100644 index 0000000..ca16b82 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base_supported_services_deep_linking.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesDeepLinking(BaseModel): + """ + Deep Linking support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether Deep Linking claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="Deep Linking version supported (e.g., \"2.0\")") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_base_supported_services_nrps.py b/flat_api/aio/models/lti_configuration1p3_base_supported_services_nrps.py new file mode 100644 index 0000000..5601cf4 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base_supported_services_nrps.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesNrps(BaseModel): + """ + Names and Role Provisioning Services support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether NRPS claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="NRPS version supported (e.g., \"2.0\")") + enabled: Optional[StrictBool] = Field(default=None, description="Whether NRPS is enabled for this platform") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version", "enabled"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version"), + "enabled": obj.get("enabled") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_base_tool.py b/flat_api/aio/models/lti_configuration1p3_base_tool.py new file mode 100644 index 0000000..bcecd7c --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_base_tool.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseTool(BaseModel): + """ + Platform/tool product information + """ # noqa: E501 + product: Optional[StrictStr] = Field(default=None, description="Product family code (e.g., canvas, moodle, schoology)") + version: Optional[StrictStr] = Field(default=None, description="Platform version string") + instance_name: Optional[StrictStr] = Field(default=None, description="Instance name (e.g., 'My University Canvas')", alias="instanceName") + instance_guid: Optional[StrictStr] = Field(default=None, description="Unique instance identifier", alias="instanceGuid") + instance_contact: Optional[StrictStr] = Field(default=None, description="Contact email or handle for the instance", alias="instanceContact") + instance_domain: Optional[StrictStr] = Field(default=None, description="Instance root domain", alias="instanceDomain") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["product", "version", "instanceName", "instanceGuid", "instanceContact", "instanceDomain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseTool from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseTool from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "product": obj.get("product"), + "version": obj.get("version"), + "instanceName": obj.get("instanceName"), + "instanceGuid": obj.get("instanceGuid"), + "instanceContact": obj.get("instanceContact"), + "instanceDomain": obj.get("instanceDomain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_deployment.py b/flat_api/aio/models/lti_configuration1p3_deployment.py new file mode 100644 index 0000000..26cbd96 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_deployment.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Deployment(BaseModel): + """ + LtiConfiguration1p3Deployment + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Deployment-based LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + parent_id: Optional[StrictStr] = Field(default=None, description="Parent configuration ID (for deployment-based configs)", alias="parentId") + deployment_key: Optional[StrictStr] = Field(default=None, description="Deployment key (e.g., schoology, classlink)", alias="deploymentKey") + deployment_breakdown_by: Optional[StrictStr] = Field(default=None, description="Custom claim used for tenant identification (parent platforms only, read-only)", alias="deploymentBreakdownBy") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Value of the custom claim that identifies this specific tenant (child platforms only)", alias="deploymentBreakdownId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching", "parentId", "deploymentKey", "deploymentBreakdownBy", "deploymentBreakdownId"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-deployment']): + raise ValueError("must be one of enum values ('1p3-deployment')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Deployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Deployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True, + "parentId": obj.get("parentId"), + "deploymentKey": obj.get("deploymentKey"), + "deploymentBreakdownBy": obj.get("deploymentBreakdownBy"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_dynamic.py b/flat_api/aio/models/lti_configuration1p3_dynamic.py new file mode 100644 index 0000000..f3ac322 --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_dynamic.py @@ -0,0 +1,205 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Dynamic(BaseModel): + """ + LtiConfiguration1p3Dynamic + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Dynamic registration LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + registration_token: Optional[StrictStr] = Field(default=None, description="Only included for admins", alias="registrationToken") + registration_url: Optional[StrictStr] = Field(default=None, description="Dynamic registration URL (only included for admins when available)", alias="registrationUrl") + registration_token_used: Optional[StrictBool] = Field(default=None, description="Whether dynamic registration token has been used", alias="registrationTokenUsed") + registration_completion_date: Optional[datetime] = Field(default=None, description="Date when dynamic registration completed (null when not completed)", alias="registrationCompletionDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching", "registrationToken", "registrationUrl", "registrationTokenUsed", "registrationCompletionDate"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-dynamic')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Dynamic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if registration_completion_date (nullable) is None + # and model_fields_set contains the field + if self.registration_completion_date is None and "registration_completion_date" in self.model_fields_set: + _dict['registrationCompletionDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Dynamic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True, + "registrationToken": obj.get("registrationToken"), + "registrationUrl": obj.get("registrationUrl"), + "registrationTokenUsed": obj.get("registrationTokenUsed"), + "registrationCompletionDate": obj.get("registrationCompletionDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration1p3_manual.py b/flat_api/aio/models/lti_configuration1p3_manual.py new file mode 100644 index 0000000..c247f2a --- /dev/null +++ b/flat_api/aio/models/lti_configuration1p3_manual.py @@ -0,0 +1,192 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.aio.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Manual(BaseModel): + """ + LtiConfiguration1p3Manual + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Manual LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-manual']): + raise ValueError("must be one of enum values ('1p3-manual')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Manual from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Manual from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_base.py b/flat_api/aio/models/lti_configuration_base.py new file mode 100644 index 0000000..16a176c --- /dev/null +++ b/flat_api/aio/models/lti_configuration_base.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationBase(BaseModel): + """ + LtiConfigurationBase + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1', '1p3']): + raise ValueError("must be one of enum values ('1p1', '1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if last_used_date (nullable) is None + # and model_fields_set contains the field + if self.last_used_date is None and "last_used_date" in self.model_fields_set: + _dict['lastUsedDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_create.py b/flat_api/aio/models/lti_configuration_create.py new file mode 100644 index 0000000..d584318 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 +from flat_api.aio.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment +from flat_api.aio.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic +from flat_api.aio.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATIONCREATE_ONE_OF_SCHEMAS = ["LtiConfigurationCreate1p1", "LtiConfigurationCreate1p3Deployment", "LtiConfigurationCreate1p3Dynamic", "LtiConfigurationCreate1p3Manual"] + +class LtiConfigurationCreate(BaseModel): + """ + Request to create a new LTI configuration (unified 1.1 and 1.3) + """ + # data type: LtiConfigurationCreate1p1 + oneof_schema_1_validator: Optional[LtiConfigurationCreate1p1] = None + # data type: LtiConfigurationCreate1p3Dynamic + oneof_schema_2_validator: Optional[LtiConfigurationCreate1p3Dynamic] = None + # data type: LtiConfigurationCreate1p3Deployment + oneof_schema_3_validator: Optional[LtiConfigurationCreate1p3Deployment] = None + # data type: LtiConfigurationCreate1p3Manual + oneof_schema_4_validator: Optional[LtiConfigurationCreate1p3Manual] = None + actual_instance: Optional[Union[LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual]] = None + one_of_schemas: Set[str] = { "LtiConfigurationCreate1p1", "LtiConfigurationCreate1p3Deployment", "LtiConfigurationCreate1p3Dynamic", "LtiConfigurationCreate1p3Manual" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfigurationCreate.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfigurationCreate1p1 + if not isinstance(v, LtiConfigurationCreate1p1): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p1`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Dynamic + if not isinstance(v, LtiConfigurationCreate1p3Dynamic): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Dynamic`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Deployment + if not isinstance(v, LtiConfigurationCreate1p3Deployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Deployment`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Manual + if not isinstance(v, LtiConfigurationCreate1p3Manual): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Manual`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfigurationCreate1p1 + try: + instance.actual_instance = LtiConfigurationCreate1p1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Dynamic + try: + instance.actual_instance = LtiConfigurationCreate1p3Dynamic.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Deployment + try: + instance.actual_instance = LtiConfigurationCreate1p3Deployment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Manual + try: + instance.actual_instance = LtiConfigurationCreate1p3Manual.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/lti_configuration_create1p1.py b/flat_api/aio/models/lti_configuration_create1p1.py new file mode 100644 index 0000000..98df1f5 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create1p1.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p1(BaseModel): + """ + LTI 1.1 manual configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.1 manual creation mode") + name: Optional[StrictStr] = Field(default=None, description="Display name for LTI 1.1 credentials") + lms: Optional[StrictStr] = Field(default=None, description="LMS identifier for LTI 1.1 credentials") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "name", "lms"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1-manual']): + raise ValueError("must be one of enum values ('1p1-manual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "name": obj.get("name"), + "lms": obj.get("lms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_create1p3_deployment.py b/flat_api/aio/models/lti_configuration_create1p3_deployment.py new file mode 100644 index 0000000..096a8e2 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create1p3_deployment.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Deployment(BaseModel): + """ + LTI 1.3 deployment-based configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 deployment-based creation mode") + deployment_type: StrictStr = Field(description="Parent platform key (e.g., blackboard, schoology, classlink, manabipocket, manabipocket-stg)", alias="deploymentType") + deployment_id: StrictStr = Field(description="Deployment identifier provided by the platform", alias="deploymentId") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id for the tenant; required for ClassLink deployments", alias="clientId") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology)", alias="deploymentBreakdownId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "deploymentType", "deploymentId", "clientId", "deploymentBreakdownId"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-deployment']): + raise ValueError("must be one of enum values ('1p3-deployment')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Deployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Deployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "deploymentType": obj.get("deploymentType"), + "deploymentId": obj.get("deploymentId"), + "clientId": obj.get("clientId"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_create1p3_dynamic.py b/flat_api/aio/models/lti_configuration_create1p3_dynamic.py new file mode 100644 index 0000000..ae23a79 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create1p3_dynamic.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Dynamic(BaseModel): + """ + LTI 1.3 dynamic registration configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 dynamic registration mode") + platform_info: Optional[LtiConfigurationCreate1p3DynamicPlatformInfo] = Field(default=None, alias="platformInfo") + locale: Optional[StrictStr] = Field(default=None, description="Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformInfo", "locale"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-dynamic')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Dynamic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of platform_info + if self.platform_info: + _dict['platformInfo'] = self.platform_info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Dynamic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformInfo": LtiConfigurationCreate1p3DynamicPlatformInfo.from_dict(obj["platformInfo"]) if obj.get("platformInfo") is not None else None, + "locale": obj.get("locale") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_create1p3_dynamic_platform_info.py b/flat_api/aio/models/lti_configuration_create1p3_dynamic_platform_info.py new file mode 100644 index 0000000..9f04a3b --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create1p3_dynamic_platform_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3DynamicPlatformInfo(BaseModel): + """ + Optional platform information for dynamic registration + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Platform display name") + url: Optional[StrictStr] = Field(default=None, description="Optional platform homepage or admin URL for reference") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "url": obj.get("url") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_create1p3_manual.py b/flat_api/aio/models/lti_configuration_create1p3_manual.py new file mode 100644 index 0000000..63300a4 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_create1p3_manual.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Manual(BaseModel): + """ + LTI 1.3 manual configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 manual creation mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="Platform access token endpoint URL", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="Platform OIDC authorization endpoint URL", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint URL for public keys", alias="jwksUrl") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "enableEmailMatching"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-manual']): + raise ValueError("must be one of enum values ('1p3-manual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Manual from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Manual from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_update.py b/flat_api/aio/models/lti_configuration_update.py new file mode 100644 index 0000000..d253d7a --- /dev/null +++ b/flat_api/aio/models/lti_configuration_update.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from flat_api.aio.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment +from flat_api.aio.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LTICONFIGURATIONUPDATE_ANY_OF_SCHEMAS = ["LtiConfigurationUpdateDeployment", "LtiConfigurationUpdateStandalone"] + +class LtiConfigurationUpdate(BaseModel): + """ + Update an existing LTI 1.3 configuration (deployment clone or standalone) + """ + + # data type: LtiConfigurationUpdateDeployment + anyof_schema_1_validator: Optional[LtiConfigurationUpdateDeployment] = None + # data type: LtiConfigurationUpdateStandalone + anyof_schema_2_validator: Optional[LtiConfigurationUpdateStandalone] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "LtiConfigurationUpdateDeployment", "LtiConfigurationUpdateStandalone" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LtiConfigurationUpdate.model_construct() + error_messages = [] + # validate data type: LtiConfigurationUpdateDeployment + if not isinstance(v, LtiConfigurationUpdateDeployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationUpdateDeployment`") + else: + return v + + # validate data type: LtiConfigurationUpdateStandalone + if not isinstance(v, LtiConfigurationUpdateStandalone): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationUpdateStandalone`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LtiConfigurationUpdate with anyOf schemas: LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[LtiConfigurationUpdateDeployment] = None + try: + instance.actual_instance = LtiConfigurationUpdateDeployment.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[LtiConfigurationUpdateStandalone] = None + try: + instance.actual_instance = LtiConfigurationUpdateStandalone.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfigurationUpdate with anyOf schemas: LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/lti_configuration_update_deployment.py b/flat_api/aio/models/lti_configuration_update_deployment.py new file mode 100644 index 0000000..c0b327c --- /dev/null +++ b/flat_api/aio/models/lti_configuration_update_deployment.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationUpdateDeployment(BaseModel): + """ + Update fields allowed for deployment-based configurations + """ # noqa: E501 + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Specific tenant identifier for multi-tenant platforms", alias="deploymentBreakdownId") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deploymentId", "deploymentBreakdownId", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateDeployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateDeployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deploymentId": obj.get("deploymentId"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_configuration_update_standalone.py b/flat_api/aio/models/lti_configuration_update_standalone.py new file mode 100644 index 0000000..0b33294 --- /dev/null +++ b/flat_api/aio/models/lti_configuration_update_standalone.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationUpdateStandalone(BaseModel): + """ + Update fields allowed for standalone (manual/dynamic) configurations + """ # noqa: E501 + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + access_token_url: Optional[StrictStr] = Field(default=None, description="Platform access token endpoint URL", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="Platform OIDC authorization endpoint URL", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint URL for public keys", alias="jwksUrl") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deploymentId", "platformIss", "platformName", "clientId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateStandalone from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateStandalone from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deploymentId": obj.get("deploymentId"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_credentials.py b/flat_api/aio/models/lti_credentials.py new file mode 100644 index 0000000..34b3b2c --- /dev/null +++ b/flat_api/aio/models/lti_credentials.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.lms_name import LmsName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiCredentials(BaseModel): + """ + A pair of LTI 1.1 OAuth credentials + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of this pair of credentials") + name: Optional[StrictStr] = Field(default=None, description="Name of the pair of credentials") + lms: Optional[LmsName] = None + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization associated to these credentials") + creator: Optional[StrictStr] = Field(default=None, description="Unique identifier of the user who created these credentials") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of these credentials", alias="creationDate") + last_usage: Optional[datetime] = Field(default=None, description="The last time these credentials were used", alias="lastUsage") + consumer_key: Optional[StrictStr] = Field(default=None, description="OAuth 1 Consumer Key", alias="consumerKey") + consumer_secret: Optional[StrictStr] = Field(default=None, description="OAuth 1 Consumer Secret", alias="consumerSecret") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "lms", "organization", "creator", "creationDate", "lastUsage", "consumerKey", "consumerSecret", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiCredentials from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiCredentials from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "lms": obj.get("lms"), + "organization": obj.get("organization"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "lastUsage": obj.get("lastUsage"), + "consumerKey": obj.get("consumerKey"), + "consumerSecret": obj.get("consumerSecret"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/lti_credentials_creation.py b/flat_api/aio/models/lti_credentials_creation.py new file mode 100644 index 0000000..a22b670 --- /dev/null +++ b/flat_api/aio/models/lti_credentials_creation.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from flat_api.aio.models.lms_name import LmsName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiCredentialsCreation(BaseModel): + """ + Creation of a pair of LTI 1.1 OAuth credentials + """ # noqa: E501 + name: Annotated[str, Field(strict=True, max_length=300)] = Field(description="Name of the pair of credentials") + lms: LmsName + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "lms"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiCredentialsCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiCredentialsCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "lms": obj.get("lms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/media_attachment.py b/flat_api/aio/models/media_attachment.py new file mode 100644 index 0000000..07a34d7 --- /dev/null +++ b/flat_api/aio/models/media_attachment.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.media_score_sharing_mode import MediaScoreSharingMode +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MediaAttachment(BaseModel): + """ + Media attachment. The API will automatically resolve the details, oEmbed, and media available if possible and return them in this object + """ # noqa: E501 + type: StrictStr = Field(description="The resolved type of the attachment: * `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: Optional[StrictStr] = Field(default=None, description="A unique Flat score identifier") + revision: Optional[StrictStr] = Field(default=None, description="A unique revision identifier of a score") + worksheet: Optional[StrictStr] = Field(default=None, description="A unique worksheet identifier") + dedicated: Optional[StrictBool] = Field(default=None, description="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") + track: Optional[StrictStr] = Field(default=None, description="A unique track identifier") + part_uuid: Optional[StrictStr] = Field(default=None, description="The UUID of the instrument part selected for this attachment (for performance submissions)", alias="partUuid") + sharing_mode: Optional[MediaScoreSharingMode] = Field(default=MediaScoreSharingMode.READ, alias="sharingMode") + lock_score_template: Optional[StrictBool] = Field(default=None, description="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.", alias="lockScoreTemplate") + title: Optional[StrictStr] = Field(default=None, description="The resolved title of the attachment") + description: Optional[StrictStr] = Field(default=None, description="The resolved description of the attachment") + html: Optional[StrictStr] = Field(default=None, description="If the attachment type is `rich` or `video`, the HTML code of the media to display ") + html_width: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If the `html` is available, the width of the widget", alias="htmlWidth") + html_height: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If the `html` is available, the height of the widget", alias="htmlHeight") + url: Optional[StrictStr] = Field(default=None, description="The url of the attachment") + thumbnail_url: Optional[StrictStr] = Field(default=None, description="If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment ", alias="thumbnailUrl") + thumbnail_width: Optional[StrictInt] = Field(default=None, description="If the `thumbnailUrl` is available, the width of the thumbnail ", alias="thumbnailWidth") + thumbnail_height: Optional[StrictInt] = Field(default=None, description="If the `thumbnailUrl` is available, the height of the thumbnail ", alias="thumbnailHeight") + author_name: Optional[StrictStr] = Field(default=None, description="The resolved author name of the attachment", alias="authorName") + author_url: Optional[StrictStr] = Field(default=None, description="The resolved author url of the attachment", alias="authorUrl") + icon_url: Optional[StrictStr] = Field(default=None, description="The URL of the icon", alias="iconUrl") + mime_type: Optional[StrictStr] = Field(default=None, description="The MIME type of the file", alias="mimeType") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="The ID of the Google Drive File", alias="googleDriveFileId") + teacher_only: Optional[StrictBool] = Field(default=False, description="If true, this attachment is only visible to teachers. When students view the assignment, attachments with this flag will be filtered out. ", alias="teacherOnly") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "score", "revision", "worksheet", "dedicated", "track", "partUuid", "sharingMode", "lockScoreTemplate", "title", "description", "html", "htmlWidth", "htmlHeight", "url", "thumbnailUrl", "thumbnailWidth", "thumbnailHeight", "authorName", "authorUrl", "iconUrl", "mimeType", "googleDriveFileId", "teacherOnly"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet']): + raise ValueError("must be one of enum values ('rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MediaAttachment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MediaAttachment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "worksheet": obj.get("worksheet"), + "dedicated": obj.get("dedicated"), + "track": obj.get("track"), + "partUuid": obj.get("partUuid"), + "sharingMode": obj.get("sharingMode") if obj.get("sharingMode") is not None else MediaScoreSharingMode.READ, + "lockScoreTemplate": obj.get("lockScoreTemplate"), + "title": obj.get("title"), + "description": obj.get("description"), + "html": obj.get("html"), + "htmlWidth": obj.get("htmlWidth"), + "htmlHeight": obj.get("htmlHeight"), + "url": obj.get("url"), + "thumbnailUrl": obj.get("thumbnailUrl"), + "thumbnailWidth": obj.get("thumbnailWidth"), + "thumbnailHeight": obj.get("thumbnailHeight"), + "authorName": obj.get("authorName"), + "authorUrl": obj.get("authorUrl"), + "iconUrl": obj.get("iconUrl"), + "mimeType": obj.get("mimeType"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "teacherOnly": obj.get("teacherOnly") if obj.get("teacherOnly") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/media_score_sharing_mode.py b/flat_api/aio/models/media_score_sharing_mode.py new file mode 100644 index 0000000..b93c5fb --- /dev/null +++ b/flat_api/aio/models/media_score_sharing_mode.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MediaScoreSharingMode(str, Enum): + """ + The sharing mode of the score for classes post and assignments + """ + + """ + allowed enum values + """ + READ = 'read' + WRITE = 'write' + COPY = 'copy' + PERFORMANCE = 'performance' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MediaScoreSharingMode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/microsoft_graph_assignment.py b/flat_api/aio/models/microsoft_graph_assignment.py new file mode 100644 index 0000000..f0d46c0 --- /dev/null +++ b/flat_api/aio/models/microsoft_graph_assignment.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MicrosoftGraphAssignment(BaseModel): + """ + A Microsoft Teams assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifier of the assignment assigned by Microsoft Teams") + state: Optional[StrictStr] = Field(default=None, description="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 ") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this assignment in the Microsoft Teams web UI", alias="alternateLink") + assign_date_time: Optional[datetime] = Field(default=None, description="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. ", alias="assignDateTime") + categories: Optional[List[StrictStr]] = Field(default=None, description="List of categories where this assignment is published under") + assign_to_type: Optional[StrictStr] = Field(default=None, description="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 ", alias="assignToType") + assigned_students_ms_ids: Optional[List[StrictStr]] = Field(default=None, description="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. ", alias="assignedStudentsMsIds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink", "assignDateTime", "categories", "assignToType", "assignedStudentsMsIds"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['draft', 'scheduled', 'published', 'assigned', 'inactive']): + raise ValueError("must be one of enum values ('draft', 'scheduled', 'published', 'assigned', 'inactive')") + return value + + @field_validator('assign_to_type') + def assign_to_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['class', 'individual']): + raise ValueError("must be one of enum values ('class', 'individual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MicrosoftGraphAssignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MicrosoftGraphAssignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink"), + "assignDateTime": obj.get("assignDateTime"), + "categories": obj.get("categories"), + "assignToType": obj.get("assignToType"), + "assignedStudentsMsIds": obj.get("assignedStudentsMsIds") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/microsoft_graph_submission.py b/flat_api/aio/models/microsoft_graph_submission.py new file mode 100644 index 0000000..49bf08f --- /dev/null +++ b/flat_api/aio/models/microsoft_graph_submission.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MicrosoftGraphSubmission(BaseModel): + """ + A Microsoft Teams submission + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of the submission assigned by Microsoft Teams") + state: StrictStr = Field(description="State of the submission") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MicrosoftGraphSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MicrosoftGraphSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_capabilities.py b/flat_api/aio/models/omr_capabilities.py new file mode 100644 index 0000000..3897d4b --- /dev/null +++ b/flat_api/aio/models/omr_capabilities.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.omr_job_output import OmrJobOutput +from flat_api.aio.models.omr_locale_details import OmrLocaleDetails +from flat_api.aio.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrCapabilities(BaseModel): + """ + What the account or app can do, for client feature-detection. + """ # noqa: E501 + steps: List[OmrStepName] = Field(description="Interactive steps this server supports.") + formats: List[StrictStr] = Field(description="Export formats available via `getOmrJobExport`.") + outputs: List[OmrJobOutput] = Field(description="Output destinations the account can use when creating a job.") + max_files: StrictInt = Field(description="Maximum number of input files that can be added to a single job.", alias="maxFiles") + max_pages: StrictInt = Field(description="Maximum number of pages allowed across all input files of a single job.", alias="maxPages") + max_parallel_jobs: StrictInt = Field(description="Maximum number of OMR jobs that can run in parallel for this account.", alias="maxParallelJobs") + max_file_size: StrictInt = Field(description="Maximum size of a single file, in bytes.", alias="maxFileSize") + accepted_mime_types: List[StrictStr] = Field(description="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. ", alias="acceptedMimeTypes") + accepted_extensions: List[StrictStr] = Field(description="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. ", alias="acceptedExtensions") + cost_per_page: Optional[StrictInt] = Field(default=None, description="Credits charged per page.", alias="costPerPage") + remaining_credits: Optional[StrictInt] = Field(default=None, description="OMR credits remaining for the account.", alias="remainingCredits") + retention_days: Optional[StrictInt] = Field(default=None, description="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. ", alias="retentionDays") + locales: List[StrictStr] = Field(description="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: List[OmrLocaleDetails] = Field(description="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. ", alias="localesDetails") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["steps", "formats", "outputs", "maxFiles", "maxPages", "maxParallelJobs", "maxFileSize", "acceptedMimeTypes", "acceptedExtensions", "costPerPage", "remainingCredits", "retentionDays", "locales", "localesDetails"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in locales_details (list) + _items = [] + if self.locales_details: + for _item_locales_details in self.locales_details: + if _item_locales_details: + _items.append(_item_locales_details.to_dict()) + _dict['localesDetails'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "steps": obj.get("steps"), + "formats": obj.get("formats"), + "outputs": obj.get("outputs"), + "maxFiles": obj.get("maxFiles"), + "maxPages": obj.get("maxPages"), + "maxParallelJobs": obj.get("maxParallelJobs"), + "maxFileSize": obj.get("maxFileSize"), + "acceptedMimeTypes": obj.get("acceptedMimeTypes"), + "acceptedExtensions": obj.get("acceptedExtensions"), + "costPerPage": obj.get("costPerPage"), + "remainingCredits": obj.get("remainingCredits"), + "retentionDays": obj.get("retentionDays"), + "locales": obj.get("locales"), + "localesDetails": [OmrLocaleDetails.from_dict(_item) for _item in obj["localesDetails"]] if obj.get("localesDetails") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_details_step_data.py b/flat_api/aio/models/omr_details_step_data.py new file mode 100644 index 0000000..c89a7ab --- /dev/null +++ b/flat_api/aio/models/omr_details_step_data.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.omr_detected_instrument import OmrDetectedInstrument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetailsStepData(BaseModel): + """ + Detected score details for the client to review before the score is built. `title` and `instruments` are detected from the input; the language is not detected and is not part of this payload (read the job's `locales`, set at creation). + """ # noqa: E501 + step: StrictStr = Field(description="Discriminator for `OmrPendingStep.data`; always `details` for this payload.") + title: Optional[StrictStr] = Field(default=None, description="OCR-detected work title.") + instruments: List[OmrDetectedInstrument] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["step", "title", "instruments"] + + @field_validator('step') + def step_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['details']): + raise ValueError("must be one of enum values ('details')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetailsStepData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetailsStepData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "title": obj.get("title"), + "instruments": [OmrDetectedInstrument.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_details_submission.py b/flat_api/aio/models/omr_details_submission.py new file mode 100644 index 0000000..74312c6 --- /dev/null +++ b/flat_api/aio/models/omr_details_submission.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.omr_instrument_override import OmrInstrumentOverride +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetailsSubmission(BaseModel): + """ + Overrides for the `details` step. Omitted fields keep the server's detected values. + """ # noqa: E501 + step: StrictStr = Field(description="Discriminator for `OmrStepSubmission`; always `details` for this submission.") + title: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="Override the detected work title.") + main_language: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=35)]] = Field(default=None, description="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. ", alias="mainLanguage") + instruments: Optional[Annotated[List[OmrInstrumentOverride], Field(max_length=200)]] = Field(default=None, description="Per-part overrides, each matched to a detected part by `index`.") + __properties: ClassVar[List[str]] = ["step", "title", "mainLanguage", "instruments"] + + @field_validator('step') + def step_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['details']): + raise ValueError("must be one of enum values ('details')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetailsSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetailsSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "title": obj.get("title"), + "mainLanguage": obj.get("mainLanguage"), + "instruments": [OmrInstrumentOverride.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + return _obj + + diff --git a/flat_api/aio/models/omr_detected_instrument.py b/flat_api/aio/models/omr_detected_instrument.py new file mode 100644 index 0000000..027d32d --- /dev/null +++ b/flat_api/aio/models/omr_detected_instrument.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetectedInstrument(BaseModel): + """ + One detected part. + """ # noqa: E501 + index: StrictInt = Field(description="0-based position of the part in the score.") + part_name: Optional[StrictStr] = Field(default=None, description="Verbatim part name read from the score.", alias="partName") + instrument_id: Optional[StrictStr] = Field(default=None, description="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.", alias="instrumentId") + instrument_name: Optional[StrictStr] = Field(default=None, description="Localized display name, resolved server-side so the client needs no instruments dictionary.", alias="instrumentName") + midi_program: Optional[StrictInt] = Field(default=None, description="General MIDI program number.", alias="midiProgram") + transpose_key: Optional[StrictStr] = Field(default=None, description="Transposition or written key shown in the UI, for example `F` for Horn in F.", alias="transposeKey") + resolved_confidence: Optional[StrictStr] = Field(default=None, description="Server confidence in the resolved instrument match.", alias="resolvedConfidence") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "partName", "instrumentId", "instrumentName", "midiProgram", "transposeKey", "resolvedConfidence"] + + @field_validator('resolved_confidence') + def resolved_confidence_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['high', 'medium', 'low']): + raise ValueError("must be one of enum values ('high', 'medium', 'low')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetectedInstrument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetectedInstrument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "partName": obj.get("partName"), + "instrumentId": obj.get("instrumentId"), + "instrumentName": obj.get("instrumentName"), + "midiProgram": obj.get("midiProgram"), + "transposeKey": obj.get("transposeKey"), + "resolvedConfidence": obj.get("resolvedConfidence") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_imported_metadata.py b/flat_api/aio/models/omr_imported_metadata.py new file mode 100644 index 0000000..e63d5b9 --- /dev/null +++ b/flat_api/aio/models/omr_imported_metadata.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrImportedMetadata(BaseModel): + """ + Metadata extracted from the recognized score. + """ # noqa: E501 + instruments: Optional[List[StrictStr]] = Field(default=None, description="Instrument IDs of the assembled parts.") + number_measures: Optional[StrictInt] = Field(default=None, description="Number of measures in the recognized score.", alias="numberMeasures") + main_tempo_qpm: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Main tempo, in quarter notes per minute.", alias="mainTempoQpm") + main_key_signature: Optional[StrictInt] = Field(default=None, description="Main key signature as a fifths count (negative for flats, positive for sharps, 0 for C major / A minor).", alias="mainKeySignature") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["instruments", "numberMeasures", "mainTempoQpm", "mainKeySignature"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrImportedMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrImportedMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "instruments": obj.get("instruments"), + "numberMeasures": obj.get("numberMeasures"), + "mainTempoQpm": obj.get("mainTempoQpm"), + "mainKeySignature": obj.get("mainKeySignature") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_instrument_override.py b/flat_api/aio/models/omr_instrument_override.py new file mode 100644 index 0000000..2f343b6 --- /dev/null +++ b/flat_api/aio/models/omr_instrument_override.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrInstrumentOverride(BaseModel): + """ + Override for a single detected part, matched by `index`. Omitted fields keep the detected value. To set the instrument you may use **either** `instrumentId` (Flat's instrument id) **or** `midiProgram` (a standard General MIDI program) — whichever your integration prefers; you do not need both. If both are sent, `instrumentId` wins; otherwise `midiProgram` is resolved to the matching instrument; otherwise the detected instrument is kept. `transposeKey` and `partName` apply independently on top. + """ # noqa: E501 + index: Annotated[int, Field(strict=True, ge=0)] = Field(description="0-based position of the part to override, matching the `index` of the detected part.") + instrument_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = Field(default=None, description="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. ", alias="instrumentId") + part_name: Optional[Annotated[str, Field(strict=True, max_length=200)]] = Field(default=None, description="Override the part name.", alias="partName") + transpose_key: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="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`. ", alias="transposeKey") + midi_program: Optional[Annotated[int, Field(le=127, strict=True, ge=0)]] = Field(default=None, description="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. ", alias="midiProgram") + __properties: ClassVar[List[str]] = ["index", "instrumentId", "partName", "transposeKey", "midiProgram"] + + @field_validator('transpose_key', mode="before") + def transpose_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^[A-G][b♭#♯]?$", value): + raise ValueError(r"must validate the regular expression /^[A-G][b♭#♯]?$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrInstrumentOverride from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrInstrumentOverride from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "instrumentId": obj.get("instrumentId"), + "partName": obj.get("partName"), + "transposeKey": obj.get("transposeKey"), + "midiProgram": obj.get("midiProgram") + }) + return _obj + + diff --git a/flat_api/aio/models/omr_job.py b/flat_api/aio/models/omr_job.py new file mode 100644 index 0000000..696c06a --- /dev/null +++ b/flat_api/aio/models/omr_job.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.omr_imported_metadata import OmrImportedMetadata +from flat_api.aio.models.omr_job_file_metadata import OmrJobFileMetadata +from flat_api.aio.models.omr_job_output import OmrJobOutput +from flat_api.aio.models.omr_job_progress import OmrJobProgress +from flat_api.aio.models.omr_job_result import OmrJobResult +from flat_api.aio.models.omr_job_retention import OmrJobRetention +from flat_api.aio.models.omr_job_status import OmrJobStatus +from flat_api.aio.models.omr_pending_step import OmrPendingStep +from flat_api.aio.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJob(BaseModel): + """ + OmrJob + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the OMR job.") + status: OmrJobStatus + output: OmrJobOutput + interactive_steps: List[OmrStepName] = Field(description="Steps this job pauses at for client input, echoing the value set at creation.", alias="interactiveSteps") + auto_rotate: Optional[StrictBool] = Field(default=None, description="Whether the job was created with `autoRotate`, echoing the value set at creation.", alias="autoRotate") + locales: Optional[List[StrictStr]] = Field(default=None, description="Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the `details` step. ") + current_step: Optional[OmrStepName] = Field(default=None, description="The pending step when `status` is `awaitingInput`. Omitted otherwise.", alias="currentStep") + pending_step: Optional[OmrPendingStep] = Field(default=None, alias="pendingStep") + estimated_credits: Optional[StrictInt] = Field(default=None, description="Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging.", alias="estimatedCredits") + progress: Optional[OmrJobProgress] = None + original_file_metadata: Optional[OmrJobFileMetadata] = Field(default=None, alias="originalFileMetadata") + imported_metadata: Optional[OmrImportedMetadata] = Field(default=None, alias="importedMetadata") + result: Optional[OmrJobResult] = None + retention: Optional[OmrJobRetention] = None + error_code: Optional[StrictStr] = Field(default=None, description="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. ", alias="errorCode") + error_message: Optional[StrictStr] = Field(default=None, description="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. ", alias="errorMessage") + creation_date: Optional[datetime] = Field(default=None, description="When the job was created.", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="When the job was last updated.", alias="modificationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "output", "interactiveSteps", "autoRotate", "locales", "currentStep", "pendingStep", "estimatedCredits", "progress", "originalFileMetadata", "importedMetadata", "result", "retention", "errorCode", "errorMessage", "creationDate", "modificationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJob from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pending_step + if self.pending_step: + _dict['pendingStep'] = self.pending_step.to_dict() + # override the default output from pydantic by calling `to_dict()` of progress + if self.progress: + _dict['progress'] = self.progress.to_dict() + # override the default output from pydantic by calling `to_dict()` of original_file_metadata + if self.original_file_metadata: + _dict['originalFileMetadata'] = self.original_file_metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of imported_metadata + if self.imported_metadata: + _dict['importedMetadata'] = self.imported_metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of retention + if self.retention: + _dict['retention'] = self.retention.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJob from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "output": obj.get("output") if obj.get("output") is not None else OmrJobOutput.LIBRARY, + "interactiveSteps": obj.get("interactiveSteps"), + "autoRotate": obj.get("autoRotate"), + "locales": obj.get("locales"), + "currentStep": obj.get("currentStep"), + "pendingStep": OmrPendingStep.from_dict(obj["pendingStep"]) if obj.get("pendingStep") is not None else None, + "estimatedCredits": obj.get("estimatedCredits"), + "progress": OmrJobProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None, + "originalFileMetadata": OmrJobFileMetadata.from_dict(obj["originalFileMetadata"]) if obj.get("originalFileMetadata") is not None else None, + "importedMetadata": OmrImportedMetadata.from_dict(obj["importedMetadata"]) if obj.get("importedMetadata") is not None else None, + "result": OmrJobResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "retention": OmrJobRetention.from_dict(obj["retention"]) if obj.get("retention") is not None else None, + "errorCode": obj.get("errorCode"), + "errorMessage": obj.get("errorMessage"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_creation.py b/flat_api/aio/models/omr_job_creation.py new file mode 100644 index 0000000..b6184ae --- /dev/null +++ b/flat_api/aio/models/omr_job_creation.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.omr_job_input_file import OmrJobInputFile +from flat_api.aio.models.omr_job_output import OmrJobOutput +from flat_api.aio.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobCreation(BaseModel): + """ + Parameters to create an OMR job. Send without `files` to create a draft (then add files with `addOmrJobFile` and run `startOmrJob`), or include `files` and `autoStart: true` to import in a single request. + """ # noqa: E501 + output: Optional[OmrJobOutput] = OmrJobOutput.LIBRARY + interactive_steps: Optional[List[OmrStepName]] = Field(default=None, description="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. ", alias="interactiveSteps") + auto_rotate: Optional[StrictBool] = Field(default=False, description="Let the server detect and correct pages uploaded sideways or upside down (90/180/270°) before recognition. Off by default: pages are recognized in the orientation they are uploaded in, which is the right choice when your client lets the user rotate pages before upload. Enable it when it does not, for example a server-to-server integration importing scans as they come. Small tilt correction (a few degrees) always runs. ", alias="autoRotate") + locales: Optional[List[StrictStr]] = Field(default=None, description="Locale hints (BCP 47) to improve text and lyric detection, for example `[\"ja\", \"en\"]`. The first entry is the primary reading language. This is the input hint; the main language can be confirmed or corrected at the `details` step. ") + collection: Optional[StrictStr] = Field(default=None, description="Target collection ID. Only used when `output` is `library`.") + idempotency_key: Optional[StrictStr] = Field(default=None, description="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. ", alias="idempotencyKey") + files: Optional[List[OmrJobInputFile]] = Field(default=None, description="Optional inline inputs for a one-shot import. For multi-image or mobile capture, omit this and use `addOmrJobFile`.") + auto_start: Optional[StrictBool] = Field(default=None, description="Start processing immediately. Only valid when `files` is provided.", alias="autoStart") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["output", "interactiveSteps", "autoRotate", "locales", "collection", "idempotencyKey", "files", "autoStart"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item_files in self.files: + if _item_files: + _items.append(_item_files.to_dict()) + _dict['files'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "output": obj.get("output") if obj.get("output") is not None else OmrJobOutput.LIBRARY, + "interactiveSteps": obj.get("interactiveSteps"), + "autoRotate": obj.get("autoRotate") if obj.get("autoRotate") is not None else False, + "locales": obj.get("locales"), + "collection": obj.get("collection"), + "idempotencyKey": obj.get("idempotencyKey"), + "files": [OmrJobInputFile.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None, + "autoStart": obj.get("autoStart") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_file_metadata.py b/flat_api/aio/models/omr_job_file_metadata.py new file mode 100644 index 0000000..3b90d24 --- /dev/null +++ b/flat_api/aio/models/omr_job_file_metadata.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileMetadata(BaseModel): + """ + Metadata about the uploaded input. + """ # noqa: E501 + number_of_pages: Optional[StrictInt] = Field(default=None, description="Total number of pages across all input files.", alias="numberOfPages") + file_count: Optional[StrictInt] = Field(default=None, description="Number of input files attached.", alias="fileCount") + filename: Optional[StrictStr] = Field(default=None, description="Original filename of the input as uploaded (of the first file when several were combined).") + file_size: Optional[StrictInt] = Field(default=None, description="Combined size of the input files, in bytes.", alias="fileSize") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the input (of the first file when several were combined).", alias="mimeType") + file_extension: Optional[StrictStr] = Field(default=None, description="File extension of the input, without the leading dot (for example `pdf`).", alias="fileExtension") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["numberOfPages", "fileCount", "filename", "fileSize", "mimeType", "fileExtension"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "numberOfPages": obj.get("numberOfPages"), + "fileCount": obj.get("fileCount"), + "filename": obj.get("filename"), + "fileSize": obj.get("fileSize"), + "mimeType": obj.get("mimeType"), + "fileExtension": obj.get("fileExtension") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_file_upload.py b/flat_api/aio/models/omr_job_file_upload.py new file mode 100644 index 0000000..423a2b0 --- /dev/null +++ b/flat_api/aio/models/omr_job_file_upload.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileUpload(BaseModel): + """ + One image or PDF added to a draft job. + """ # noqa: E501 + file: Union[StrictBytes, StrictStr] = Field(description="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: Optional[StrictStr] = Field(default=None, description="Optional original filename, kept for display.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["file", "filename"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileUpload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileUpload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file": obj.get("file"), + "filename": obj.get("filename") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_file_upload_result.py b/flat_api/aio/models/omr_job_file_upload_result.py new file mode 100644 index 0000000..6af4c91 --- /dev/null +++ b/flat_api/aio/models/omr_job_file_upload_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileUploadResult(BaseModel): + """ + Result of adding a file to a draft job. + """ # noqa: E501 + file_index: Optional[StrictInt] = Field(default=None, description="0-based index assigned to the uploaded file.", alias="fileIndex") + file_count: Optional[StrictInt] = Field(default=None, description="Total number of files now attached to the job.", alias="fileCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["fileIndex", "fileCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileUploadResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileUploadResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fileIndex": obj.get("fileIndex"), + "fileCount": obj.get("fileCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_input_file.py b/flat_api/aio/models/omr_job_input_file.py new file mode 100644 index 0000000..30f9d53 --- /dev/null +++ b/flat_api/aio/models/omr_job_input_file.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobInputFile(BaseModel): + """ + A single image or PDF input, base64-encoded. + """ # noqa: E501 + file: Union[StrictBytes, StrictStr] = Field(description="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: Optional[StrictStr] = Field(default=None, description="Optional original filename, kept for display.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["file", "filename"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobInputFile from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobInputFile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file": obj.get("file"), + "filename": obj.get("filename") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_output.py b/flat_api/aio/models/omr_job_output.py new file mode 100644 index 0000000..04bebd2 --- /dev/null +++ b/flat_api/aio/models/omr_job_output.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrJobOutput(str, Enum): + """ + Where the result of the job goes. * `library`: import the result into the Flat Library and create a score (default). * `musicxml`: finalize the result only, downloadable via `getOmrJobExport`. No score is created, for third-party integrations that do not use the Library. + """ + + """ + allowed enum values + """ + LIBRARY = 'library' + MUSICXML = 'musicxml' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrJobOutput from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/omr_job_progress.py b/flat_api/aio/models/omr_job_progress.py new file mode 100644 index 0000000..2fa6849 --- /dev/null +++ b/flat_api/aio/models/omr_job_progress.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobProgress(BaseModel): + """ + Live progress while the job is processing. + """ # noqa: E501 + percent: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Completion percentage (0-100).") + text: Optional[StrictStr] = Field(default=None, description="Localized progress message, ready to display.") + key: Optional[StrictStr] = Field(default=None, description="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. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["percent", "text", "key"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobProgress from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobProgress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "percent": obj.get("percent"), + "text": obj.get("text"), + "key": obj.get("key") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_result.py b/flat_api/aio/models/omr_job_result.py new file mode 100644 index 0000000..1e9c0e9 --- /dev/null +++ b/flat_api/aio/models/omr_job_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobResult(BaseModel): + """ + The outcome of a finished job. Present when `status` is `done`. + """ # noqa: E501 + score: Optional[StrictStr] = Field(default=None, description="Created score ID, when `output` is `library`.") + exports: Optional[List[StrictStr]] = Field(default=None, description="Formats available via `getOmrJobExport`, for example `[\"musicxml\", \"mxl\", \"midi\"]`.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "exports"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "exports": obj.get("exports") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_retention.py b/flat_api/aio/models/omr_job_retention.py new file mode 100644 index 0000000..d52a97f --- /dev/null +++ b/flat_api/aio/models/omr_job_retention.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobRetention(BaseModel): + """ + Data-retention state of the job. Present only on jobs whose `output` is `musicxml`. Jobs imported into the Flat library are part of your library content, are not covered by this policy, and omit this object entirely. Erasure happens shortly after `expiryDate` rather than exactly on it. Plan for the deadline, not the instant. + """ # noqa: E501 + expiry_date: datetime = Field(description="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. ", alias="expiryDate") + expired_date: Optional[datetime] = Field(default=None, description="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`. ", alias="expiredDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["expiryDate", "expiredDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobRetention from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobRetention from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expiryDate": obj.get("expiryDate"), + "expiredDate": obj.get("expiredDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_job_status.py b/flat_api/aio/models/omr_job_status.py new file mode 100644 index 0000000..b2111da --- /dev/null +++ b/flat_api/aio/models/omr_job_status.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrJobStatus(str, Enum): + """ + Status of the job. * `draft`: created, files can still be added; not yet started or charged. * `processing`: the pipeline is running. * `awaitingInput`: paused on the `currentStep`, waiting for the client to submit it. * `done`: finished. See `result`. * `error`: failed. See `errorCode`. * `canceled`: canceled by the client. + """ + + """ + allowed enum values + """ + DRAFT = 'draft' + PROCESSING = 'processing' + AWAITINGINPUT = 'awaitingInput' + DONE = 'done' + ERROR = 'error' + CANCELED = 'canceled' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrJobStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/omr_locale_details.py b/flat_api/aio/models/omr_locale_details.py new file mode 100644 index 0000000..5fedb51 --- /dev/null +++ b/flat_api/aio/models/omr_locale_details.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrLocaleDetails(BaseModel): + """ + An OCR-selectable locale with its English name. + """ # noqa: E501 + code: StrictStr = Field(description="BCP 47 locale code. Always one of the codes listed in `locales`.", json_schema_extra={"examples": ["vi"]}) + name: StrictStr = Field(description="English name of the language, for display in a picker.", json_schema_extra={"examples": ["Vietnamese"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrLocaleDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrLocaleDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_pending_step.py b/flat_api/aio/models/omr_pending_step.py new file mode 100644 index 0000000..eea5fa5 --- /dev/null +++ b/flat_api/aio/models/omr_pending_step.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from flat_api.aio.models.omr_details_step_data import OmrDetailsStepData +from flat_api.aio.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrPendingStep(BaseModel): + """ + The step currently awaiting client input. The `data` shape is keyed by `step`. + """ # noqa: E501 + step: OmrStepName + data: OmrDetailsStepData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["step", "data"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrPendingStep from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrPendingStep from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "data": OmrDetailsStepData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/omr_step_name.py b/flat_api/aio/models/omr_step_name.py new file mode 100644 index 0000000..e1d3c90 --- /dev/null +++ b/flat_api/aio/models/omr_step_name.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrStepName(str, Enum): + """ + Interactive pipeline step. Forward-compatible: new values may be added over time. Only steps a client lists in `interactiveSteps` can pause that client's job; any step a client does not list (including future ones) is auto-resolved by the server. * `details`: confirm or adjust the detected title, main language and instruments before the score is built. Resuming from this step is fast: note recognition is already done and is not run again. + """ + + """ + allowed enum values + """ + DETAILS = 'details' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrStepName from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/organization_invitation.py b/flat_api/aio/models/organization_invitation.py new file mode 100644 index 0000000..e42e352 --- /dev/null +++ b/flat_api/aio/models/organization_invitation.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.organization_roles import OrganizationRoles +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OrganizationInvitation(BaseModel): + """ + Details of an invitation to join an organization + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The invitation unique identifier") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the invitation", alias="creationDate") + organization: StrictStr = Field(description="The unique identifier of the Organization this invitation belongs to") + organization_role: OrganizationRoles = Field(alias="organizationRole") + custom_code: Optional[StrictStr] = Field(description="Enrollment code to use when joining this organization", alias="customCode") + email: Optional[StrictStr] = Field(default=None, description="The email address this invitation was sent to") + invited_by: Optional[StrictStr] = Field(default=None, description="The unique identifier of the User who created this invitation", alias="invitedBy") + html_url: Optional[StrictStr] = Field(default=None, description="URL to join the organization using this invitation", alias="htmlUrl") + allow_multiple_use: StrictBool = Field(description="If true, the invitation can be used multiple times. If false, the invitation can only be used once. ", alias="allowMultipleUse") + used_by: Optional[List[StrictStr]] = Field(default=None, description="List of users who used this invitation", alias="usedBy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creationDate", "organization", "organizationRole", "customCode", "email", "invitedBy", "htmlUrl", "allowMultipleUse", "usedBy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationInvitation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if custom_code (nullable) is None + # and model_fields_set contains the field + if self.custom_code is None and "custom_code" in self.model_fields_set: + _dict['customCode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationInvitation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "customCode": obj.get("customCode"), + "email": obj.get("email"), + "invitedBy": obj.get("invitedBy"), + "htmlUrl": obj.get("htmlUrl"), + "allowMultipleUse": obj.get("allowMultipleUse"), + "usedBy": obj.get("usedBy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/organization_invitation_creation.py b/flat_api/aio/models/organization_invitation_creation.py new file mode 100644 index 0000000..7b79ed5 --- /dev/null +++ b/flat_api/aio/models/organization_invitation_creation.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OrganizationInvitationCreation(BaseModel): + """ + The parameters to create an organization invitation + """ # noqa: E501 + email: Optional[StrictStr] = Field(default=None, description="The email address you want to send the invitation to") + organization_role: Optional[StrictStr] = Field(default='teacher', description="User's Organization Role", alias="organizationRole") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["email", "organizationRole"] + + @field_validator('organization_role') + def organization_role_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['admin', 'teacher', 'accountAdmin']): + raise ValueError("must be one of enum values ('admin', 'teacher', 'accountAdmin')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationInvitationCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationInvitationCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "email": obj.get("email"), + "organizationRole": obj.get("organizationRole") if obj.get("organizationRole") is not None else 'teacher' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/organization_roles.py b/flat_api/aio/models/organization_roles.py new file mode 100644 index 0000000..cf85a5f --- /dev/null +++ b/flat_api/aio/models/organization_roles.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OrganizationRoles(str, Enum): + """ + User's Organization Role (for Edu users only) + """ + + """ + allowed enum values + """ + ADMIN = 'admin' + ACCOUNTADMIN = 'accountAdmin' + TEACHER = 'teacher' + USER = 'user' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OrganizationRoles from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/organization_user_access_token_creation.py b/flat_api/aio/models/organization_user_access_token_creation.py new file mode 100644 index 0000000..c428146 --- /dev/null +++ b/flat_api/aio/models/organization_user_access_token_creation.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from flat_api.aio.models.app_scopes import AppScopes +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OrganizationUserAccessTokenCreation(BaseModel): + """ + Creation of a delegated API access token for an organization user + """ # noqa: E501 + scopes: List[AppScopes] = Field(description="List of requested scopes for this credential") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scopes"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationUserAccessTokenCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationUserAccessTokenCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scopes": obj.get("scopes") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/rename_group_request.py b/flat_api/aio/models/rename_group_request.py new file mode 100644 index 0000000..b3e8786 --- /dev/null +++ b/flat_api/aio/models/rename_group_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RenameGroupRequest(BaseModel): + """ + RenameGroupRequest + """ # noqa: E501 + name: StrictStr = Field(description="New name for the group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RenameGroupRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RenameGroupRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/resource_collaborator.py b/flat_api/aio/models/resource_collaborator.py new file mode 100644 index 0000000..fa24b06 --- /dev/null +++ b/flat_api/aio/models/resource_collaborator.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.group import Group +from flat_api.aio.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ResourceCollaborator(BaseModel): + """ + A collaborator of a score. The `userEmail` and `group` are only available if the requesting user is a collaborator of the related score (otherwise these permissions are not listed or exposed publicly). + """ # noqa: E501 + acl_read: StrictBool = Field(description="`True` if the current user can read the current document ", alias="aclRead") + acl_write: StrictBool = Field(description="`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. ", alias="aclWrite") + acl_admin: StrictBool = Field(description="`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. ", alias="aclAdmin") + is_collaborator: Optional[StrictBool] = Field(default=False, description="`True` if the current user is a collaborator of the current document (direct or via group). ", alias="isCollaborator") + collaborator_type: Optional[StrictStr] = Field(default=None, description="The type of the collaborator for the resource ", alias="collaboratorType") + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of the permission") + var_date: Optional[datetime] = Field(default=None, description="The date when the permission was added", alias="date") + score: Optional[StrictStr] = Field(default=None, description="If this object is a permission of a score, this property will contain the unique identifier of the score") + collection: Optional[StrictStr] = Field(default=None, description="If this object is a permission of a collection, this property will contain the unique identifier of the collection") + user: Optional[UserPublic] = None + group: Optional[Group] = None + user_email: Optional[StrictStr] = Field(default=None, description="If the collaborator is not a user of Flat yet, this field will contain their email. ", alias="userEmail") + invited: Optional[StrictBool] = Field(default=None, description="If this property is `true`, this is still a pending invitation ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["aclRead", "aclWrite", "aclAdmin", "isCollaborator", "collaboratorType", "id", "date", "score", "collection", "user", "group", "userEmail", "invited"] + + @field_validator('collaborator_type') + def collaborator_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['owner', 'user', 'group']): + raise ValueError("must be one of enum values ('owner', 'user', 'group')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceCollaborator from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceCollaborator from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else False, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False, + "isCollaborator": obj.get("isCollaborator") if obj.get("isCollaborator") is not None else False, + "collaboratorType": obj.get("collaboratorType"), + "id": obj.get("id"), + "date": obj.get("date"), + "score": obj.get("score"), + "collection": obj.get("collection"), + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "group": Group.from_dict(obj["group"]) if obj.get("group") is not None else None, + "userEmail": obj.get("userEmail"), + "invited": obj.get("invited") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/resource_collaborator_creation.py b/flat_api/aio/models/resource_collaborator_creation.py new file mode 100644 index 0000000..e64f366 --- /dev/null +++ b/flat_api/aio/models/resource_collaborator_creation.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ResourceCollaboratorCreation(BaseModel): + """ + Add a collaborator to a resource. + """ # noqa: E501 + user: Optional[StrictStr] = Field(default=None, description="The unique identifier of a Flat user") + group: Optional[StrictStr] = Field(default=None, description="The unique identifier of a Flat group") + user_email: Optional[StrictStr] = Field(default=None, description="Fill this field to invite an individual user by email. ", alias="userEmail") + user_token: Optional[StrictStr] = Field(default=None, description="Token received in an invitation to join the score. ", alias="userToken") + acl_read: Optional[StrictBool] = Field(default=True, description="`True` if the related user can read the score. (probably true if the user has a permission on the document). ", alias="aclRead") + acl_write: Optional[StrictBool] = Field(default=False, description="`True` if the related user can modify the score. ", alias="aclWrite") + acl_admin: Optional[StrictBool] = Field(default=False, description="`True` if the related user can manage the current document, i.e. changing the document permissions and deleting the document ", alias="aclAdmin") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user", "group", "userEmail", "userToken", "aclRead", "aclWrite", "aclAdmin"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceCollaboratorCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceCollaboratorCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user"), + "group": obj.get("group"), + "userEmail": obj.get("userEmail"), + "userToken": obj.get("userToken"), + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else True, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/resource_rights.py b/flat_api/aio/models/resource_rights.py new file mode 100644 index 0000000..ce365ad --- /dev/null +++ b/flat_api/aio/models/resource_rights.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ResourceRights(BaseModel): + """ + The rights of the current user on a score or collection + """ # noqa: E501 + acl_read: StrictBool = Field(description="`True` if the current user can read the current document ", alias="aclRead") + acl_write: StrictBool = Field(description="`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. ", alias="aclWrite") + acl_admin: StrictBool = Field(description="`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. ", alias="aclAdmin") + is_collaborator: Optional[StrictBool] = Field(default=False, description="`True` if the current user is a collaborator of the current document (direct or via group). ", alias="isCollaborator") + collaborator_type: Optional[StrictStr] = Field(default=None, description="The type of the collaborator for the resource ", alias="collaboratorType") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["aclRead", "aclWrite", "aclAdmin", "isCollaborator", "collaboratorType"] + + @field_validator('collaborator_type') + def collaborator_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['owner', 'user', 'group']): + raise ValueError("must be one of enum values ('owner', 'user', 'group')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceRights from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceRights from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else False, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False, + "isCollaborator": obj.get("isCollaborator") if obj.get("isCollaborator") is not None else False, + "collaboratorType": obj.get("collaboratorType") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comment.py b/flat_api/aio/models/score_comment.py new file mode 100644 index 0000000..3f69514 --- /dev/null +++ b/flat_api/aio/models/score_comment.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_comment_context import ScoreCommentContext +from flat_api.aio.models.score_comment_moderation import ScoreCommentModeration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreComment(BaseModel): + """ + Comment added on a sheet music + """ # noqa: E501 + id: StrictStr = Field(description="The comment unique identifier") + type: StrictStr = Field(description="The type of the comment") + user: StrictStr = Field(description="The author unique identifier") + score: StrictStr = Field(description="The unique identifier of the score where the comment was posted") + revision: Optional[StrictStr] = Field(default=None, description="The unique identifier of the revision where the comment was posted") + reply_to: Optional[StrictStr] = Field(default=None, description="When the comment is a reply to another comment, the unique identifier of the parent comment ", alias="replyTo") + var_date: datetime = Field(description="The date when the comment was posted", alias="date") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last comment modification", alias="modificationDate") + comment: StrictStr = Field(description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: StrictStr = Field(description="A raw version of the comment, that can be displayed without parsing the mentions. ", alias="rawComment") + context: Optional[ScoreCommentContext] = None + mentions: Optional[List[StrictStr]] = Field(default=None, description="The list of user identifiers mentioned in this comment") + resolved: Optional[StrictBool] = Field(default=None, description="For inline comments, the comment can be marked as resolved and will be hidden in the future responses ") + resolved_by: Optional[StrictStr] = Field(default=None, description="If the comment is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved ", alias="resolvedBy") + moderation: Optional[ScoreCommentModeration] = None + spam: Optional[StrictBool] = Field(default=None, description="`true` if the message has been detected as spam and hidden from other users ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "user", "score", "revision", "replyTo", "date", "modificationDate", "comment", "rawComment", "context", "mentions", "resolved", "resolvedBy", "moderation", "spam"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['document', 'inline']): + raise ValueError("must be one of enum values ('document', 'inline')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreComment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # override the default output from pydantic by calling `to_dict()` of moderation + if self.moderation: + _dict['moderation'] = self.moderation.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreComment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "user": obj.get("user"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "replyTo": obj.get("replyTo"), + "date": obj.get("date"), + "modificationDate": obj.get("modificationDate"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None, + "mentions": obj.get("mentions"), + "resolved": obj.get("resolved"), + "resolvedBy": obj.get("resolvedBy"), + "moderation": ScoreCommentModeration.from_dict(obj["moderation"]) if obj.get("moderation") is not None else None, + "spam": obj.get("spam") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comment_context.py b/flat_api/aio/models/score_comment_context.py new file mode 100644 index 0000000..56fd45b --- /dev/null +++ b/flat_api/aio/models/score_comment_context.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentContext(BaseModel): + """ + The context of the comment (for inline/contextualized comments). A context will include all the information related to the location of the comment (i.e. score parts, range of measure, time position). + """ # noqa: E501 + part_uuid: StrictStr = Field(description="The unique identifier (UUID) of the score part", alias="partUuid") + staff_idx: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="(Deprecated, use `staffUuid`) The identifier of the staff", alias="staffIdx") + staff_uuid: Optional[StrictStr] = Field(default=None, description="The unique identifier (UUID) of the staff", alias="staffUuid") + measure_uuids: List[StrictStr] = Field(description="The list of measure UUIDs", alias="measureUuids") + start_time_pos: Union[StrictFloat, StrictInt] = Field(alias="startTimePos") + stop_time_pos: Union[StrictFloat, StrictInt] = Field(alias="stopTimePos") + start_dpq: Union[StrictFloat, StrictInt] = Field(alias="startDpq") + stop_dpq: Union[StrictFloat, StrictInt] = Field(alias="stopDpq") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["partUuid", "staffIdx", "staffUuid", "measureUuids", "startTimePos", "stopTimePos", "startDpq", "stopDpq"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentContext from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentContext from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "partUuid": obj.get("partUuid"), + "staffIdx": obj.get("staffIdx"), + "staffUuid": obj.get("staffUuid"), + "measureUuids": obj.get("measureUuids"), + "startTimePos": obj.get("startTimePos"), + "stopTimePos": obj.get("stopTimePos"), + "startDpq": obj.get("startDpq"), + "stopDpq": obj.get("stopDpq") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comment_creation.py b/flat_api/aio/models/score_comment_creation.py new file mode 100644 index 0000000..1a2b317 --- /dev/null +++ b/flat_api/aio/models/score_comment_creation.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_comment_context import ScoreCommentContext +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentCreation(BaseModel): + """ + Creation of a comment + """ # noqa: E501 + revision: Optional[StrictStr] = Field(default=None, description="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. ") + comment: StrictStr = Field(description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: Optional[StrictStr] = Field(default=None, description="A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. ", alias="rawComment") + mentions: Optional[List[StrictStr]] = Field(default=None, description="The list of user identifiers mentioned in this comment") + reply_to: Optional[StrictStr] = Field(default=None, description="When the comment is a reply to another comment, the unique identifier of the parent comment ", alias="replyTo") + context: Optional[ScoreCommentContext] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["revision", "comment", "rawComment", "mentions", "replyTo", "context"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "revision": obj.get("revision"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "mentions": obj.get("mentions"), + "replyTo": obj.get("replyTo"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comment_moderation.py b/flat_api/aio/models/score_comment_moderation.py new file mode 100644 index 0000000..c5a8e89 --- /dev/null +++ b/flat_api/aio/models/score_comment_moderation.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentModeration(BaseModel): + """ + Information about the comment being moderated + """ # noqa: E501 + hidden: Optional[StrictBool] = Field(default=None, description="If true, this comment will be hidden from other users") + reason: Optional[StrictStr] = Field(default=None, description="If the comment is hidden, the reason why this one has been moderated") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["hidden", "reason"] + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['spam', 'inappropriate']): + raise ValueError("must be one of enum values ('spam', 'inappropriate')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentModeration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentModeration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "hidden": obj.get("hidden"), + "reason": obj.get("reason") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comment_update.py b/flat_api/aio/models/score_comment_update.py new file mode 100644 index 0000000..2459b2b --- /dev/null +++ b/flat_api/aio/models/score_comment_update.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.score_comment_context import ScoreCommentContext +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentUpdate(BaseModel): + """ + Update of a comment + """ # noqa: E501 + revision: Optional[StrictStr] = Field(default=None, description="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. ") + comment: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=10000)]] = Field(default=None, description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=10000)]] = Field(default=None, description="A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. ", alias="rawComment") + context: Optional[ScoreCommentContext] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["revision", "comment", "rawComment", "context"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "revision": obj.get("revision"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_comments_counts.py b/flat_api/aio/models/score_comments_counts.py new file mode 100644 index 0000000..811c2bd --- /dev/null +++ b/flat_api/aio/models/score_comments_counts.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentsCounts(BaseModel): + """ + A computed version of the total, unique, weekly, monthly and yearly number of comments added on the documents (this doesn't include inline comments). + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of comments added to the score") + unique: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The unique (1/user) number of comments added to the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly unique number of comments added to the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly unique number of comments added to the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly unique number of comments added to the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "unique", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentsCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentsCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "unique": obj.get("unique"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation.py b/flat_api/aio/models/score_creation.py new file mode 100644 index 0000000..bdfb2b0 --- /dev/null +++ b/flat_api/aio/models/score_creation.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.aio.models.score_creation_builder_data import ScoreCreationBuilderData +from flat_api.aio.models.score_creation_file_import import ScoreCreationFileImport +from flat_api.aio.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +SCORECREATION_ONE_OF_SCHEMAS = ["ScoreCreationBuilderData", "ScoreCreationFileImport", "ScoreCreationGoogleDriveImport"] + +class ScoreCreation(BaseModel): + """ + ScoreCreation + """ + # data type: ScoreCreationBuilderData + oneof_schema_1_validator: Optional[ScoreCreationBuilderData] = None + # data type: ScoreCreationFileImport + oneof_schema_2_validator: Optional[ScoreCreationFileImport] = None + # data type: ScoreCreationGoogleDriveImport + oneof_schema_3_validator: Optional[ScoreCreationGoogleDriveImport] = None + actual_instance: Optional[Union[ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport]] = None + one_of_schemas: Set[str] = { "ScoreCreationBuilderData", "ScoreCreationFileImport", "ScoreCreationGoogleDriveImport" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = ScoreCreation.model_construct() + error_messages = [] + match = 0 + # validate data type: ScoreCreationBuilderData + if not isinstance(v, ScoreCreationBuilderData): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationBuilderData`") + else: + match += 1 + # validate data type: ScoreCreationFileImport + if not isinstance(v, ScoreCreationFileImport): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationFileImport`") + else: + match += 1 + # validate data type: ScoreCreationGoogleDriveImport + if not isinstance(v, ScoreCreationGoogleDriveImport): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationGoogleDriveImport`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ScoreCreationBuilderData + try: + instance.actual_instance = ScoreCreationBuilderData.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ScoreCreationFileImport + try: + instance.actual_instance = ScoreCreationFileImport.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ScoreCreationGoogleDriveImport + try: + instance.actual_instance = ScoreCreationGoogleDriveImport.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/aio/models/score_creation_builder_data.py b/flat_api/aio/models/score_creation_builder_data.py new file mode 100644 index 0000000..784e47a --- /dev/null +++ b/flat_api/aio/models/score_creation_builder_data.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData +from flat_api.aio.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderData(BaseModel): + """ + ScoreCreationBuilderData + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + builder_data: ScoreCreationBuilderDataAllOfBuilderData = Field(alias="builderData") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "builderData"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of builder_data + if self.builder_data: + _dict['builderData'] = self.builder_data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "builderData": ScoreCreationBuilderDataAllOfBuilderData.from_dict(obj["builderData"]) if obj.get("builderData") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_builder_data_all_of_builder_data.py b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data.py new file mode 100644 index 0000000..f394e1b --- /dev/null +++ b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderData(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderData + """ # noqa: E501 + score_data: ScoreCreationBuilderDataAllOfBuilderDataScoreData = Field(alias="scoreData") + layout_data: Optional[ScoreCreationBuilderDataAllOfBuilderDataLayoutData] = Field(default=None, alias="layoutData") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scoreData", "layoutData"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of score_data + if self.score_data: + _dict['scoreData'] = self.score_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of layout_data + if self.layout_data: + _dict['layoutData'] = self.layout_data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scoreData": ScoreCreationBuilderDataAllOfBuilderDataScoreData.from_dict(obj["scoreData"]) if obj.get("scoreData") is not None else None, + "layoutData": ScoreCreationBuilderDataAllOfBuilderDataLayoutData.from_dict(obj["layoutData"]) if obj.get("layoutData") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_layout_data.py b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_layout_data.py new file mode 100644 index 0000000..3f432e9 --- /dev/null +++ b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_layout_data.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataLayoutData(BaseModel): + """ + Control the appearance of the score. If missing, default values are used. + """ # noqa: E501 + notes_spacing_coeff: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A float value >= 1 that controls the spacing between notes.", alias="notesSpacingCoeff") + length_unit: Optional[StrictStr] = Field(default='cm', description="The unit to use for layout customizations", alias="lengthUnit") + page_height: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The height of the page in chosen unit (`lengthUnit`).", alias="pageHeight") + page_width: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The width of the page in chosen unit (`lengthUnit`).", alias="pageWidth") + page_margin_top: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The top margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginTop") + page_margin_bottom: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The bottom margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginBottom") + page_margin_left: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The left margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginLeft") + page_margin_right: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The right margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginRight") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["notesSpacingCoeff", "lengthUnit", "pageHeight", "pageWidth", "pageMarginTop", "pageMarginBottom", "pageMarginLeft", "pageMarginRight"] + + @field_validator('length_unit') + def length_unit_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['cm', 'inch']): + raise ValueError("must be one of enum values ('cm', 'inch')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "notesSpacingCoeff": obj.get("notesSpacingCoeff"), + "lengthUnit": obj.get("lengthUnit") if obj.get("lengthUnit") is not None else 'cm', + "pageHeight": obj.get("pageHeight"), + "pageWidth": obj.get("pageWidth"), + "pageMarginTop": obj.get("pageMarginTop"), + "pageMarginBottom": obj.get("pageMarginBottom"), + "pageMarginLeft": obj.get("pageMarginLeft"), + "pageMarginRight": obj.get("pageMarginRight") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data.py b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data.py new file mode 100644 index 0000000..8bd3579 --- /dev/null +++ b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.aio.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataScoreData(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderDataScoreData + """ # noqa: E501 + use_tab_staff: Optional[StrictBool] = Field(default=None, description="true if the TAB staff is displayed with fretted instruments", alias="useTabStaff") + use_chord_grid: Optional[StrictBool] = Field(default=None, description="true if the chord grid must be displayed with fretted instruments", alias="useChordGrid") + fifths: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The key signature of the score (expressed between -7 and 7). Major C is used when the value is not provided.") + nb_beats: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of beats in the measure", alias="nbBeats") + beat_type: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The duration of a beat in the measure", alias="beatType") + instruments: List[ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments] = Field(description="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). ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["useTabStaff", "useChordGrid", "fifths", "nbBeats", "beatType", "instruments"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "useTabStaff": obj.get("useTabStaff"), + "useChordGrid": obj.get("useChordGrid"), + "fifths": obj.get("fifths"), + "nbBeats": obj.get("nbBeats"), + "beatType": obj.get("beatType"), + "instruments": [ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py new file mode 100644 index 0000000..eca1a93 --- /dev/null +++ b/flat_api/aio/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments + """ # noqa: E501 + group: StrictStr = Field(description="The identifier of the instrument group (e.g. `keyboards`, `brass`)") + instrument: StrictStr = Field(description="The identifier of the instrument (e.g. `piano`, `trumpet`)") + long_name: Optional[StrictStr] = Field(default=None, description="The full name of the instrument", alias="longName") + short_name: Optional[StrictStr] = Field(default=None, description="The abbreviation of the name of the instrument", alias="shortName") + has_quarter_tone: Optional[StrictBool] = Field(default=None, description="True if the part can use quarter tones (prevents the part from having a TAB staff or chord grid)", alias="hasQuarterTone") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["group", "instrument", "longName", "shortName", "hasQuarterTone"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "group": obj.get("group"), + "instrument": obj.get("instrument"), + "longName": obj.get("longName"), + "shortName": obj.get("shortName"), + "hasQuarterTone": obj.get("hasQuarterTone") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_common.py b/flat_api/aio/models/score_creation_common.py new file mode 100644 index 0000000..0f1c8ca --- /dev/null +++ b/flat_api/aio/models/score_creation_common.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationCommon(BaseModel): + """ + ScoreCreationCommon + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationCommon from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationCommon from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_file_import.py b/flat_api/aio/models/score_creation_file_import.py new file mode 100644 index 0000000..2eb2a41 --- /dev/null +++ b/flat_api/aio/models/score_creation_file_import.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationFileImport(BaseModel): + """ + ScoreCreationFileImport + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + filename: Optional[StrictStr] = Field(default=None, description="If this is an imported file, its filename") + data: StrictStr = Field(description="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: Optional[StrictStr] = Field(default=None, description="The optional encoding of the score data. This property must match the encoding used for the `data` property.", alias="dataEncoding") + supports_tasks: Optional[StrictBool] = Field(default=None, description="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}`. ", alias="supportsTasks") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "filename", "data", "dataEncoding", "supportsTasks"] + + @field_validator('data_encoding') + def data_encoding_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['base64']): + raise ValueError("must be one of enum values ('base64')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationFileImport from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationFileImport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "filename": obj.get("filename"), + "data": obj.get("data"), + "dataEncoding": obj.get("dataEncoding"), + "supportsTasks": obj.get("supportsTasks") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_google_drive_import.py b/flat_api/aio/models/score_creation_google_drive_import.py new file mode 100644 index 0000000..ca52150 --- /dev/null +++ b/flat_api/aio/models/score_creation_google_drive_import.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_privacy import ScorePrivacy +from flat_api.aio.models.score_source import ScoreSource +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationGoogleDriveImport(BaseModel): + """ + ScoreCreationGoogleDriveImport + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + source: ScoreSource + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "source"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationGoogleDriveImport from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationGoogleDriveImport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "source": ScoreSource.from_dict(obj["source"]) if obj.get("source") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_creation_type.py b/flat_api/aio/models/score_creation_type.py new file mode 100644 index 0000000..4341a97 --- /dev/null +++ b/flat_api/aio/models/score_creation_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreCreationType(str, Enum): + """ + The type of creation (an original, an arrangement) + """ + + """ + allowed enum values + """ + ORIGINAL = 'original' + ARRANGEMENT = 'arrangement' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreCreationType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_details.py b/flat_api/aio/models/score_details.py new file mode 100644 index 0000000..d1eb20d --- /dev/null +++ b/flat_api/aio/models/score_details.py @@ -0,0 +1,229 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.aio.models.resource_collaborator import ResourceCollaborator +from flat_api.aio.models.resource_rights import ResourceRights +from flat_api.aio.models.score_comments_counts import ScoreCommentsCounts +from flat_api.aio.models.score_creation_type import ScoreCreationType +from flat_api.aio.models.score_details_all_of_me import ScoreDetailsAllOfMe +from flat_api.aio.models.score_license import ScoreLicense +from flat_api.aio.models.score_likes_counts import ScoreLikesCounts +from flat_api.aio.models.score_plays_counts import ScorePlaysCounts +from flat_api.aio.models.score_privacy import ScorePrivacy +from flat_api.aio.models.score_views_counts import ScoreViewsCounts +from flat_api.aio.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreDetails(BaseModel): + """ + The score and all its details + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score") + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the score (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + title: StrictStr = Field(description="The title of the score") + privacy: ScorePrivacy + user: UserPublic + html_url: StrictStr = Field(description="The url where the score can be viewed in a web browser", alias="htmlUrl") + edit_html_url: StrictStr = Field(description="The url where the score can be edited in a web browser", alias="editHtmlUrl") + subtitle: Optional[StrictStr] = Field(default=None, description="Subtitle of the score") + lyricist: Optional[StrictStr] = Field(default=None, description="Lyricist of the score") + arranger: Optional[StrictStr] = Field(default=None, description="Arranger of the score") + composer: Optional[StrictStr] = Field(default=None, description="Composer of the score") + description: Optional[StrictStr] = Field(default=None, description="Description of the creation") + tags: Optional[List[Annotated[str, Field(strict=True)]]] = Field(default=None, description="Tags describing the score") + creation_type: Optional[ScoreCreationType] = Field(default=None, alias="creationType") + license: Optional[ScoreLicense] = None + license_text: Optional[StrictStr] = Field(default=None, description="Additional license text written on the exported/printed score", alias="licenseText") + duration_time: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="In seconds, an approximate duration of the score", alias="durationTime") + number_measures: Optional[StrictInt] = Field(default=None, description="The number of measures in the score", alias="numberMeasures") + main_tempo_qpm: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The main tempo of the score (in QPM)", alias="mainTempoQpm") + main_key_signature: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The main key signature of the score (expressed between -7 and 7).", alias="mainKeySignature") + rights: Optional[ResourceRights] = None + collaborators: List[ResourceCollaborator] = Field(description="The list of the collaborators of the score") + creation_date: datetime = Field(description="The date when the score was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last revision of the score", alias="modificationDate") + publication_date: Optional[datetime] = Field(default=None, description="The date when the score was published on Flat", alias="publicationDate") + scheduled_deletion_date: Optional[datetime] = Field(default=None, description="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, and can be restored with a paying account up to 90 days. ", alias="scheduledDeletionDate") + highlighted_date: Optional[datetime] = Field(default=None, description="The date when the score was highlighted (featured) on our community", alias="highlightedDate") + organization: Optional[StrictStr] = Field(default=None, description="If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. ") + parent_score: Optional[StrictStr] = Field(default=None, description="If the score has been forked, the unique identifier of the parent score. ", alias="parentScore") + instruments: List[StrictStr] = Field(description="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 Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. ") + instruments_names: List[StrictStr] = Field(description="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. ", alias="instrumentsNames") + samples: List[StrictStr] = Field(description="An array of the audio sample identifiers used by the different score parts. The format of the strings is `{instrument-group}.{sample-id}`. ") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="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}` ", alias="googleDriveFileId") + likes: Optional[ScoreLikesCounts] = None + comments: Optional[ScoreCommentsCounts] = None + views: Optional[ScoreViewsCounts] = None + plays: Optional[ScorePlaysCounts] = None + collections: Optional[List[StrictStr]] = Field(default=None, description="The list of parent collections this score is included in. Please note that you might not have access to all of them.") + me: Optional[ScoreDetailsAllOfMe] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "sharingKey", "title", "privacy", "user", "htmlUrl", "editHtmlUrl", "subtitle", "lyricist", "arranger", "composer", "description", "tags", "creationType", "license", "licenseText", "durationTime", "numberMeasures", "mainTempoQpm", "mainKeySignature", "rights", "collaborators", "creationDate", "modificationDate", "publicationDate", "scheduledDeletionDate", "highlightedDate", "organization", "parentScore", "instruments", "instrumentsNames", "samples", "googleDriveFileId", "likes", "comments", "views", "plays", "collections", "me"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of rights + if self.rights: + _dict['rights'] = self.rights.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collaborators (list) + _items = [] + if self.collaborators: + for _item_collaborators in self.collaborators: + if _item_collaborators: + _items.append(_item_collaborators.to_dict()) + _dict['collaborators'] = _items + # override the default output from pydantic by calling `to_dict()` of likes + if self.likes: + _dict['likes'] = self.likes.to_dict() + # override the default output from pydantic by calling `to_dict()` of comments + if self.comments: + _dict['comments'] = self.comments.to_dict() + # override the default output from pydantic by calling `to_dict()` of views + if self.views: + _dict['views'] = self.views.to_dict() + # override the default output from pydantic by calling `to_dict()` of plays + if self.plays: + _dict['plays'] = self.plays.to_dict() + # override the default output from pydantic by calling `to_dict()` of me + if self.me: + _dict['me'] = self.me.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if creation_type (nullable) is None + # and model_fields_set contains the field + if self.creation_type is None and "creation_type" in self.model_fields_set: + _dict['creationType'] = None + + # set to None if license (nullable) is None + # and model_fields_set contains the field + if self.license is None and "license" in self.model_fields_set: + _dict['license'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "sharingKey": obj.get("sharingKey"), + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "htmlUrl": obj.get("htmlUrl"), + "editHtmlUrl": obj.get("editHtmlUrl"), + "subtitle": obj.get("subtitle"), + "lyricist": obj.get("lyricist"), + "arranger": obj.get("arranger"), + "composer": obj.get("composer"), + "description": obj.get("description"), + "tags": obj.get("tags"), + "creationType": obj.get("creationType"), + "license": obj.get("license"), + "licenseText": obj.get("licenseText"), + "durationTime": obj.get("durationTime"), + "numberMeasures": obj.get("numberMeasures"), + "mainTempoQpm": obj.get("mainTempoQpm"), + "mainKeySignature": obj.get("mainKeySignature"), + "rights": ResourceRights.from_dict(obj["rights"]) if obj.get("rights") is not None else None, + "collaborators": [ResourceCollaborator.from_dict(_item) for _item in obj["collaborators"]] if obj.get("collaborators") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "publicationDate": obj.get("publicationDate"), + "scheduledDeletionDate": obj.get("scheduledDeletionDate"), + "highlightedDate": obj.get("highlightedDate"), + "organization": obj.get("organization"), + "parentScore": obj.get("parentScore"), + "instruments": obj.get("instruments"), + "instrumentsNames": obj.get("instrumentsNames"), + "samples": obj.get("samples"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "likes": ScoreLikesCounts.from_dict(obj["likes"]) if obj.get("likes") is not None else None, + "comments": ScoreCommentsCounts.from_dict(obj["comments"]) if obj.get("comments") is not None else None, + "views": ScoreViewsCounts.from_dict(obj["views"]) if obj.get("views") is not None else None, + "plays": ScorePlaysCounts.from_dict(obj["plays"]) if obj.get("plays") is not None else None, + "collections": obj.get("collections"), + "me": ScoreDetailsAllOfMe.from_dict(obj["me"]) if obj.get("me") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_details_all_of_me.py b/flat_api/aio/models/score_details_all_of_me.py new file mode 100644 index 0000000..7483e8a --- /dev/null +++ b/flat_api/aio/models/score_details_all_of_me.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreDetailsAllOfMe(BaseModel): + """ + Information about the authenticated user and this score + """ # noqa: E501 + is_liked: StrictBool = Field(description="True if the current user likes this score", alias="isLiked") + is_in_library: StrictBool = Field(description="True if the score is stored in one of the user's collections", alias="isInLibrary") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["isLiked", "isInLibrary"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreDetailsAllOfMe from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreDetailsAllOfMe from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "isLiked": obj.get("isLiked"), + "isInLibrary": obj.get("isInLibrary") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_fork.py b/flat_api/aio/models/score_fork.py new file mode 100644 index 0000000..79dd158 --- /dev/null +++ b/flat_api/aio/models/score_fork.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreFork(BaseModel): + """ + Options to fork the score + """ # noqa: E501 + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_disabled: Optional[StrictBool] = Field(default=False, description="If set to `true`, the API won't create the score on Google Drive ", alias="googleDriveDisabled") + keep_original_title: Optional[StrictBool] = Field(default=None, description="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). ", alias="keepOriginalTitle") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collection", "googleDriveDisabled", "keepOriginalTitle"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreFork from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if collection (nullable) is None + # and model_fields_set contains the field + if self.collection is None and "collection" in self.model_fields_set: + _dict['collection'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreFork from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collection": obj.get("collection"), + "googleDriveDisabled": obj.get("googleDriveDisabled") if obj.get("googleDriveDisabled") is not None else False, + "keepOriginalTitle": obj.get("keepOriginalTitle") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_license.py b/flat_api/aio/models/score_license.py new file mode 100644 index 0000000..64e27fe --- /dev/null +++ b/flat_api/aio/models/score_license.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreLicense(str, Enum): + """ + License of the creation. Read more about the Creative Commons licenses on https://creativecommons.org/licenses/ + """ + + """ + allowed enum values + """ + COPYRIGHT = 'copyright' + CC0 = 'cc0' + CC_MINUS_BY = 'cc-by' + CC_MINUS_BY_MINUS_SA = 'cc-by-sa' + CC_MINUS_BY_MINUS_ND = 'cc-by-nd' + CC_MINUS_BY_MINUS_NC = 'cc-by-nc' + CC_MINUS_BY_MINUS_NC_MINUS_SA = 'cc-by-nc-sa' + CC_MINUS_BY_MINUS_NC_MINUS_ND = 'cc-by-nc-nd' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreLicense from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_likes_counts.py b/flat_api/aio/models/score_likes_counts.py new file mode 100644 index 0000000..0ceffd3 --- /dev/null +++ b/flat_api/aio/models/score_likes_counts.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreLikesCounts(BaseModel): + """ + A computed version of the weekly, monthly, yearly and total number of likes for a score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of likes of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last week") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last month") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last year") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreLikesCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreLikesCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_modification.py b/flat_api/aio/models/score_modification.py new file mode 100644 index 0000000..12e34e4 --- /dev/null +++ b/flat_api/aio/models/score_modification.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.score_creation_type import ScoreCreationType +from flat_api.aio.models.score_license import ScoreLicense +from flat_api.aio.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreModification(BaseModel): + """ + Edit the score metadata + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="The title of the score") + subtitle: Optional[StrictStr] = Field(default=None, description="The subtitle of the score") + composer: Optional[StrictStr] = Field(default=None, description="The composer of the score") + lyricist: Optional[StrictStr] = Field(default=None, description="The lyricist of the score") + arranger: Optional[StrictStr] = Field(default=None, description="The arranger of the score") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + sharing_key: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="When using the `privacy` mode `privateLink`, this property can be used to set a custom sharing key, otherwise a new key will be generated.", alias="sharingKey") + description: Optional[Annotated[str, Field(strict=True, max_length=2000)]] = Field(default=None, description="Description of the creation") + tags: Optional[List[StrictStr]] = Field(default=None, description="Tags describing the score") + creation_type: Optional[ScoreCreationType] = Field(default=None, alias="creationType") + license: Optional[ScoreLicense] = None + license_text: Optional[StrictStr] = Field(default=None, description="The rights info written on the score", alias="licenseText") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "subtitle", "composer", "lyricist", "arranger", "privacy", "sharingKey", "description", "tags", "creationType", "license", "licenseText"] + + @field_validator('sharing_key', mode="before") + def sharing_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^[a-f0-9]{128}$", value): + raise ValueError(r"must validate the regular expression /^[a-f0-9]{128}$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreModification from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if subtitle (nullable) is None + # and model_fields_set contains the field + if self.subtitle is None and "subtitle" in self.model_fields_set: + _dict['subtitle'] = None + + # set to None if composer (nullable) is None + # and model_fields_set contains the field + if self.composer is None and "composer" in self.model_fields_set: + _dict['composer'] = None + + # set to None if lyricist (nullable) is None + # and model_fields_set contains the field + if self.lyricist is None and "lyricist" in self.model_fields_set: + _dict['lyricist'] = None + + # set to None if arranger (nullable) is None + # and model_fields_set contains the field + if self.arranger is None and "arranger" in self.model_fields_set: + _dict['arranger'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if creation_type (nullable) is None + # and model_fields_set contains the field + if self.creation_type is None and "creation_type" in self.model_fields_set: + _dict['creationType'] = None + + # set to None if license (nullable) is None + # and model_fields_set contains the field + if self.license is None and "license" in self.model_fields_set: + _dict['license'] = None + + # set to None if license_text (nullable) is None + # and model_fields_set contains the field + if self.license_text is None and "license_text" in self.model_fields_set: + _dict['licenseText'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreModification from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "subtitle": obj.get("subtitle"), + "composer": obj.get("composer"), + "lyricist": obj.get("lyricist"), + "arranger": obj.get("arranger"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "sharingKey": obj.get("sharingKey"), + "description": obj.get("description"), + "tags": obj.get("tags"), + "creationType": obj.get("creationType"), + "license": obj.get("license"), + "licenseText": obj.get("licenseText") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_plays_counts.py b/flat_api/aio/models/score_plays_counts.py new file mode 100644 index 0000000..eb79ac5 --- /dev/null +++ b/flat_api/aio/models/score_plays_counts.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScorePlaysCounts(BaseModel): + """ + A computed version of the total, weekly, monthly, and yearly number of plays of the score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of plays of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly number of plays of the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly number of plays of the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly number of plays of the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScorePlaysCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScorePlaysCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_privacy.py b/flat_api/aio/models/score_privacy.py new file mode 100644 index 0000000..76bc05f --- /dev/null +++ b/flat_api/aio/models/score_privacy.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScorePrivacy(str, Enum): + """ + The score main privacy mode. - `public`: The score is public on the Internet. This one can be accessible at the url `https://flat.io/score/{score}` and can be modified and administered by specified collaborators users. - `private`: The score is private and can be only accessed, modified and administered by specified collaborators users. - `privateLink`: The score is private but can be accessed using a private link `htmlUrl` or the private key in the property `sharingKey`. - `organizationPublic`: _Available only with [Flat for Education](https://flat.io/edu)._ The score is public in the organization: users of the same organization can access it. The score can be modified and administered by specified collaborators users. The score can also be individually shared to a set of users or groups using the different collaborators API methods. When a file is synchronized from an external source (e.g. Google Drive) and the sharing options are changed on the source, Flat will choose the best privacy mode for the file. When using a [Flat for Education](https://flat.io/edu) account, some of the modes may not be available if disabled by an administrator of the organization (e.g. by default the `public` mode is not available). + """ + + """ + allowed enum values + """ + PUBLIC = 'public' + PRIVATE = 'private' + ORGANIZATIONPUBLIC = 'organizationPublic' + PRIVATELINK = 'privateLink' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScorePrivacy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_revision.py b/flat_api/aio/models/score_revision.py new file mode 100644 index 0000000..299a138 --- /dev/null +++ b/flat_api/aio/models/score_revision.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_revision_statistics import ScoreRevisionStatistics +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreRevision(BaseModel): + """ + A score revision metadata + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the revision.") + user: Optional[StrictStr] = Field(default=None, description="The user identifier who created the revision") + score: StrictStr = Field(description="The score identifier") + collaborators: Optional[List[StrictStr]] = None + var_date: datetime = Field(description="The date when this revision was created", alias="date") + event: Optional[StrictStr] = Field(default=None, description="The last event (action id) of the revision") + description: Optional[StrictStr] = Field(default=None, description="A description associated to the revision") + autosave: Optional[StrictBool] = Field(default=None, description="True if this revision was automatically generated by Flat and not on purpose by the user. ") + statistics: Optional[ScoreRevisionStatistics] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "user", "score", "collaborators", "date", "event", "description", "autosave", "statistics"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevision from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of statistics + if self.statistics: + _dict['statistics'] = self.statistics.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevision from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "user": obj.get("user"), + "score": obj.get("score"), + "collaborators": obj.get("collaborators"), + "date": obj.get("date"), + "event": obj.get("event"), + "description": obj.get("description"), + "autosave": obj.get("autosave"), + "statistics": ScoreRevisionStatistics.from_dict(obj["statistics"]) if obj.get("statistics") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_revision_creation.py b/flat_api/aio/models/score_revision_creation.py new file mode 100644 index 0000000..25bb3ae --- /dev/null +++ b/flat_api/aio/models/score_revision_creation.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreRevisionCreation(BaseModel): + """ + A new created revision + """ # noqa: E501 + data: StrictStr = Field(description="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 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. ", json_schema_extra={"examples": [""]}) + data_encoding: Optional[StrictStr] = Field(default=None, description="The optional encoding of the score data. This property must match the encoding used for the `data` property.", alias="dataEncoding") + autosave: Optional[StrictBool] = Field(default=None, description="Must be set to `true` if the revision was created automatically. ") + description: Optional[StrictStr] = Field(default=None, description="A description associated to the revision") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["data", "dataEncoding", "autosave", "description"] + + @field_validator('data_encoding') + def data_encoding_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['base64']): + raise ValueError("must be one of enum values ('base64')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevisionCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevisionCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": obj.get("data"), + "dataEncoding": obj.get("dataEncoding"), + "autosave": obj.get("autosave"), + "description": obj.get("description") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_revision_statistics.py b/flat_api/aio/models/score_revision_statistics.py new file mode 100644 index 0000000..ff0919d --- /dev/null +++ b/flat_api/aio/models/score_revision_statistics.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreRevisionStatistics(BaseModel): + """ + The statistics related to the score revision (additions and deletions) + """ # noqa: E501 + additions: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of additions operations in the last revision") + deletions: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of deletions operations in the last revision") + start_date: Optional[datetime] = Field(default=None, description="The date of the first action included in this revision", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The date of the latest action included in this revision", alias="endDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["additions", "deletions", "startDate", "endDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevisionStatistics from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevisionStatistics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "additions": obj.get("additions"), + "deletions": obj.get("deletions"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_source.py b/flat_api/aio/models/score_source.py new file mode 100644 index 0000000..a98f518 --- /dev/null +++ b/flat_api/aio/models/score_source.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreSource(BaseModel): + """ + ScoreSource + """ # noqa: E501 + google_drive: Optional[StrictStr] = Field(default=None, description="If the score is a file on Google Drive, this 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. ", alias="googleDrive") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["googleDrive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreSource from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "googleDrive": obj.get("googleDrive") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_summary.py b/flat_api/aio/models/score_summary.py new file mode 100644 index 0000000..530f0a4 --- /dev/null +++ b/flat_api/aio/models/score_summary.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_privacy import ScorePrivacy +from flat_api.aio.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreSummary(BaseModel): + """ + A summary of the score details + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score") + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the score (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + title: StrictStr = Field(description="The title of the score") + privacy: ScorePrivacy + user: UserPublic + html_url: StrictStr = Field(description="The url where the score can be viewed in a web browser", alias="htmlUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "sharingKey", "title", "privacy", "user", "htmlUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "sharingKey": obj.get("sharingKey"), + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "htmlUrl": obj.get("htmlUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_track.py b/flat_api/aio/models/score_track.py new file mode 100644 index 0000000..c8e1c3f --- /dev/null +++ b/flat_api/aio/models/score_track.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_track_point import ScoreTrackPoint +from flat_api.aio.models.score_track_purpose import ScoreTrackPurpose +from flat_api.aio.models.score_track_state import ScoreTrackState +from flat_api.aio.models.score_track_type import ScoreTrackType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrack(BaseModel): + """ + An audio track for a score + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score track") + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + score: Optional[StrictStr] = Field(default=None, description="The unique identifier of the score. Absent for Free Record performance submissions, which are recorded without an attached score. ") + creator: StrictStr = Field(description="The unique identifier of the track creator") + creation_date: datetime = Field(description="The creation date of the track", alias="creationDate") + modification_date: datetime = Field(description="The modification date of the track", alias="modificationDate") + default: StrictBool = Field(description="True if the track should be used as default audio source") + state: ScoreTrackState + type: ScoreTrackType + purpose: ScoreTrackPurpose + url: Optional[StrictStr] = Field(default=None, description="The URL of the track") + media_id: Optional[StrictStr] = Field(default=None, description="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` ", alias="mediaId") + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "score", "creator", "creationDate", "modificationDate", "default", "state", "type", "purpose", "url", "mediaId", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrack from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrack from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "score": obj.get("score"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "type": obj.get("type"), + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "url": obj.get("url"), + "mediaId": obj.get("mediaId"), + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_track_creation.py b/flat_api/aio/models/score_track_creation.py new file mode 100644 index 0000000..1ede872 --- /dev/null +++ b/flat_api/aio/models/score_track_creation.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_track_point import ScoreTrackPoint +from flat_api.aio.models.score_track_purpose import ScoreTrackPurpose +from flat_api.aio.models.score_track_state import ScoreTrackState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackCreation(BaseModel): + """ + Creation of a new track. This one must contain the URL of the track or the corresponding file + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + default: Optional[StrictBool] = Field(default=None, description="True if the track should be used as default audio source") + state: Optional[ScoreTrackState] = ScoreTrackState.DRAFT + purpose: Optional[ScoreTrackPurpose] = ScoreTrackPurpose.COMMON + url: Optional[StrictStr] = Field(default=None, description="The URL of the track") + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "default", "state", "purpose", "url", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "url": obj.get("url"), + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_track_creation_response.py b/flat_api/aio/models/score_track_creation_response.py new file mode 100644 index 0000000..5f68efb --- /dev/null +++ b/flat_api/aio/models/score_track_creation_response.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from flat_api.aio.models.score_track import ScoreTrack +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackCreationResponse(BaseModel): + """ + Response for track creation including optional upload information + """ # noqa: E501 + track: ScoreTrack + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["track"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackCreationResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of track + if self.track: + _dict['track'] = self.track.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackCreationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "track": ScoreTrack.from_dict(obj["track"]) if obj.get("track") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_track_point.py b/flat_api/aio/models/score_track_point.py new file mode 100644 index 0000000..d4df106 --- /dev/null +++ b/flat_api/aio/models/score_track_point.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackPoint(BaseModel): + """ + A track synchronization point + """ # noqa: E501 + type: StrictStr = Field(description="The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid`") + measure_uuid: Optional[UUID] = Field(default=None, description="The measure unique identifier", alias="measureUuid") + time: Union[StrictFloat, StrictInt] = Field(description="The corresponding time in seconds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "measureUuid", "time"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['measure', 'end']): + raise ValueError("must be one of enum values ('measure', 'end')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackPoint from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackPoint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "measureUuid": obj.get("measureUuid"), + "time": obj.get("time") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_track_purpose.py b/flat_api/aio/models/score_track_purpose.py new file mode 100644 index 0000000..501b72f --- /dev/null +++ b/flat_api/aio/models/score_track_purpose.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreTrackPurpose(str, Enum): + """ + The purpose of the audio track + """ + + """ + allowed enum values + """ + COMMON = 'common' + PERFORMANCESUBMISSION = 'performanceSubmission' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackPurpose from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_track_state.py b/flat_api/aio/models/score_track_state.py new file mode 100644 index 0000000..d2f21e1 --- /dev/null +++ b/flat_api/aio/models/score_track_state.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreTrackState(str, Enum): + """ + State of the track + """ + + """ + allowed enum values + """ + DRAFT = 'draft' + COMPLETED = 'completed' + DELETED = 'deleted' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_track_type.py b/flat_api/aio/models/score_track_type.py new file mode 100644 index 0000000..d9bd943 --- /dev/null +++ b/flat_api/aio/models/score_track_type.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreTrackType(str, Enum): + """ + The type of an audio track + """ + + """ + allowed enum values + """ + AUDIO = 'audio' + SOUNDCLOUD = 'soundcloud' + YOUTUBE = 'youtube' + VIMEO = 'vimeo' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/score_track_update.py b/flat_api/aio/models/score_track_update.py new file mode 100644 index 0000000..0bd6af5 --- /dev/null +++ b/flat_api/aio/models/score_track_update.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.score_track_point import ScoreTrackPoint +from flat_api.aio.models.score_track_purpose import ScoreTrackPurpose +from flat_api.aio.models.score_track_state import ScoreTrackState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackUpdate(BaseModel): + """ + Update an existing track. + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + default: Optional[StrictBool] = Field(default=None, description="True if the track should be used as default audio source") + state: Optional[ScoreTrackState] = ScoreTrackState.DRAFT + purpose: Optional[ScoreTrackPurpose] = ScoreTrackPurpose.COMMON + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "default", "state", "purpose", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/score_views_counts.py b/flat_api/aio/models/score_views_counts.py new file mode 100644 index 0000000..674fab2 --- /dev/null +++ b/flat_api/aio/models/score_views_counts.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreViewsCounts(BaseModel): + """ + A computed version of the total, weekly, monthly, and yearly number of views of the score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of views of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly number of views of the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly number of views of the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly number of views of the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreViewsCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreViewsCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/task.py b/flat_api/aio/models/task.py new file mode 100644 index 0000000..557fc4e --- /dev/null +++ b/flat_api/aio/models/task.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.task_progress import TaskProgress +from flat_api.aio.models.task_result import TaskResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Task(BaseModel): + """ + An asynchronous task + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the task") + type: Optional[StrictStr] = Field(default=None, description="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 ") + state: StrictStr = Field(description="State of the Task") + format: Optional[StrictStr] = Field(default=None, description="For files processing, the file format (e.g. `mp3`, `wav`)") + score: Optional[StrictStr] = Field(default=None, description="The score unique identifier for tasks related to scores") + revision: Optional[StrictStr] = Field(default=None, description="The score revision identifier for tasks related to scores") + progress: Optional[TaskProgress] = None + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the task", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The last modification date of the task", alias="modificationDate") + done_date: Optional[datetime] = Field(default=None, description="The date when the task has been completed", alias="doneDate") + result: Optional[TaskResult] = None + error_history: Optional[List[StrictStr]] = Field(default=None, description="If any errors happened when processing this task, the list of errors identifiers", alias="errorHistory") + is_cancellable: Optional[StrictBool] = Field(default=None, description="Whether the task can be canceled by the user. Only `true` when the task is in `created` state (waiting to be processed). ", alias="isCancellable") + children: Optional[List[Task]] = Field(default=None, description="Child tasks for hierarchical task structures (e.g., conversion subtasks)") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "state", "format", "score", "revision", "progress", "creationDate", "modificationDate", "doneDate", "result", "errorHistory", "isCancellable", "children"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['created', 'blocked', 'doing', 'done', 'canceled', 'error']): + raise ValueError("must be one of enum values ('created', 'blocked', 'doing', 'done', 'canceled', 'error')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Task from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "is_cancellable", + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of progress + if self.progress: + _dict['progress'] = self.progress.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in children (list) + _items = [] + if self.children: + for _item_children in self.children: + if _item_children: + _items.append(_item_children.to_dict()) + _dict['children'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Task from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "state": obj.get("state"), + "format": obj.get("format"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "progress": TaskProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "doneDate": obj.get("doneDate"), + "result": TaskResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "errorHistory": obj.get("errorHistory"), + "isCancellable": obj.get("isCancellable"), + "children": [Task.from_dict(_item) for _item in obj["children"]] if obj.get("children") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +# TODO: Rewrite to not use raise_errors +Task.model_rebuild(raise_errors=False) + diff --git a/flat_api/aio/models/task_export_options.py b/flat_api/aio/models/task_export_options.py new file mode 100644 index 0000000..b86c008 --- /dev/null +++ b/flat_api/aio/models/task_export_options.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskExportOptions(BaseModel): + """ + Options for the requested export + """ # noqa: E501 + parts: Optional[List[StrictStr]] = Field(default=None, description="A list of parts to specifically export") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["parts"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskExportOptions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskExportOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parts": obj.get("parts") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/task_progress.py b/flat_api/aio/models/task_progress.py new file mode 100644 index 0000000..f626978 --- /dev/null +++ b/flat_api/aio/models/task_progress.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskProgress(BaseModel): + """ + Details about the task progression + """ # noqa: E501 + percent: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Percent of the task progression") + text: Optional[StrictStr] = Field(default=None, description="Text details of the task progress") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["percent", "text"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskProgress from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskProgress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "percent": obj.get("percent"), + "text": obj.get("text") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/task_result.py b/flat_api/aio/models/task_result.py new file mode 100644 index 0000000..829e286 --- /dev/null +++ b/flat_api/aio/models/task_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskResult(BaseModel): + """ + Optional result information about this task + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL of the generated file, when the task produces one") + error: Optional[StrictStr] = Field(default=None, description="Error message, when the task failed") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["url", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/teaching_theme.py b/flat_api/aio/models/teaching_theme.py new file mode 100644 index 0000000..a5d5204 --- /dev/null +++ b/flat_api/aio/models/teaching_theme.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TeachingTheme(str, Enum): + """ + Teaching theme + """ + + """ + allowed enum values + """ + COMPOSITION = 'composition' + MUSIC_MINUS_THEORY = 'music-theory' + GENERAL_MINUS_MUSIC = 'general-music' + BAND = 'band' + CHOIR = 'choir' + ORCHESTRA = 'orchestra' + JAZZ_MINUS_ENSEMBLE = 'jazz-ensemble' + MUSIC_MINUS_TECHNOLOGY = 'music-technology' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TeachingTheme from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/tutteo_product.py b/flat_api/aio/models/tutteo_product.py new file mode 100644 index 0000000..fc70afb --- /dev/null +++ b/flat_api/aio/models/tutteo_product.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TutteoProduct(str, Enum): + """ + A Tutteo product. * `flat`: [Flat](https://flat.io) - Music notation software for individual users * `flatEdu`: [Flat for Education](https://flat.io/edu) - Music notation software for schools and educators * `msnippet`: [Music Snippet](https://musicsnippet.com) - Embeddable music snippets for websites * `embed`: [Flat Embed](https://flat.io/developers/embed) - Embeddable music notation editor + """ + + """ + allowed enum values + """ + FLAT = 'flat' + FLATEDU = 'flatEdu' + MSNIPPET = 'msnippet' + EMBED = 'embed' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TutteoProduct from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/aio/models/user_admin_update.py b/flat_api/aio/models/user_admin_update.py new file mode 100644 index 0000000..9c6502c --- /dev/null +++ b/flat_api/aio/models/user_admin_update.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.aio.models.organization_roles import OrganizationRoles +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserAdminUpdate(BaseModel): + """ + User update as an organization admin + """ # noqa: E501 + password: Optional[Annotated[str, Field(min_length=6, strict=True, max_length=1000)]] = Field(default=None, description="Password of the account") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + username: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=30)]] = Field(default=None, description="Username of the account") + firstname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="First name of the user") + lastname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="Last name of the user") + email: Optional[StrictStr] = Field(default=None, description="Email of the account") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["password", "organizationRole", "username", "firstname", "lastname", "email"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAdminUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAdminUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "password": obj.get("password"), + "organizationRole": obj.get("organizationRole"), + "username": obj.get("username"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "email": obj.get("email") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_azure_details.py b/flat_api/aio/models/user_azure_details.py new file mode 100644 index 0000000..8a3439f --- /dev/null +++ b/flat_api/aio/models/user_azure_details.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserAzureDetails(BaseModel): + """ + UserAzureDetails + """ # noqa: E501 + oid: Optional[StrictStr] = Field(default=None, description="User object identifier on Azure AD") + hd: Optional[StrictStr] = Field(default=None, description="User tenant (domain name)") + preferred_username: Optional[StrictStr] = Field(default=None, description="User Preferred Username (UPN), i.e. the main email of the user", alias="preferredUsername") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["oid", "hd", "preferredUsername"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAzureDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAzureDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "oid": obj.get("oid"), + "hd": obj.get("hd"), + "preferredUsername": obj.get("preferredUsername") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_basics.py b/flat_api/aio/models/user_basics.py new file mode 100644 index 0000000..4e0f9ee --- /dev/null +++ b/flat_api/aio/models/user_basics.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.tutteo_product import TutteoProduct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserBasics(BaseModel): + """ + UserBasics + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: Optional[StrictStr] = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserBasics from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if picture (nullable) is None + # and model_fields_set contains the field + if self.picture is None and "picture" in self.model_fields_set: + _dict['picture'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserBasics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_community_profile_links.py b/flat_api/aio/models/user_community_profile_links.py new file mode 100644 index 0000000..8a76d12 --- /dev/null +++ b/flat_api/aio/models/user_community_profile_links.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserCommunityProfileLinks(BaseModel): + """ + Social networks links + """ # noqa: E501 + spotify_url: Optional[StrictStr] = Field(default=None, description="Spotify Profile URL", alias="spotifyUrl") + youtube_url: Optional[StrictStr] = Field(default=None, description="YouTube channel URL", alias="youtubeUrl") + soundcloud_url: Optional[StrictStr] = Field(default=None, description="SoundCloud Profile URL", alias="soundcloudUrl") + tiktok_url: Optional[StrictStr] = Field(default=None, description="TikTok profile URL. For updates, also accepts TikTok usernames", alias="tiktokUrl") + instagram_url: Optional[StrictStr] = Field(default=None, description="Instagram profile URL. For updates, also accepts Instagram usernames", alias="instagramUrl") + website_url: Optional[StrictStr] = Field(default=None, description="Personal website URL", alias="websiteUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["spotifyUrl", "youtubeUrl", "soundcloudUrl", "tiktokUrl", "instagramUrl", "websiteUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserCommunityProfileLinks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if spotify_url (nullable) is None + # and model_fields_set contains the field + if self.spotify_url is None and "spotify_url" in self.model_fields_set: + _dict['spotifyUrl'] = None + + # set to None if youtube_url (nullable) is None + # and model_fields_set contains the field + if self.youtube_url is None and "youtube_url" in self.model_fields_set: + _dict['youtubeUrl'] = None + + # set to None if soundcloud_url (nullable) is None + # and model_fields_set contains the field + if self.soundcloud_url is None and "soundcloud_url" in self.model_fields_set: + _dict['soundcloudUrl'] = None + + # set to None if tiktok_url (nullable) is None + # and model_fields_set contains the field + if self.tiktok_url is None and "tiktok_url" in self.model_fields_set: + _dict['tiktokUrl'] = None + + # set to None if instagram_url (nullable) is None + # and model_fields_set contains the field + if self.instagram_url is None and "instagram_url" in self.model_fields_set: + _dict['instagramUrl'] = None + + # set to None if website_url (nullable) is None + # and model_fields_set contains the field + if self.website_url is None and "website_url" in self.model_fields_set: + _dict['websiteUrl'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserCommunityProfileLinks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "spotifyUrl": obj.get("spotifyUrl"), + "youtubeUrl": obj.get("youtubeUrl"), + "soundcloudUrl": obj.get("soundcloudUrl"), + "tiktokUrl": obj.get("tiktokUrl"), + "instagramUrl": obj.get("instagramUrl"), + "websiteUrl": obj.get("websiteUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_creation.py b/flat_api/aio/models/user_creation.py new file mode 100644 index 0000000..f254101 --- /dev/null +++ b/flat_api/aio/models/user_creation.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserCreation(BaseModel): + """ + User creation + """ # noqa: E501 + username: Annotated[str, Field(min_length=1, strict=True, max_length=30)] = Field(description="Username of the new account") + firstname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="First name of the user") + lastname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="Last name of the user") + email: Optional[StrictStr] = Field(default=None, description="Email of the new account") + password: Annotated[str, Field(min_length=6, strict=True, max_length=1000)] = Field(description="Password of the new account") + locale: Optional[StrictStr] = Field(default='en', description="User language. Input values will be automatically normalized to a supported locale code.") + role: Optional[StrictStr] = Field(default='user', description="Role of the new account") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["username", "firstname", "lastname", "email", "password", "locale", "role"] + + @field_validator('role') + def role_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['user', 'teacher', 'admin', 'accountAdmin']): + raise ValueError("must be one of enum values ('user', 'teacher', 'admin', 'accountAdmin')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "email": obj.get("email"), + "password": obj.get("password"), + "locale": obj.get("locale") if obj.get("locale") is not None else 'en', + "role": obj.get("role") if obj.get("role") is not None else 'user' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_details.py b/flat_api/aio/models/user_details.py new file mode 100644 index 0000000..3213953 --- /dev/null +++ b/flat_api/aio/models/user_details.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.class_roles import ClassRoles +from flat_api.aio.models.organization_roles import OrganizationRoles +from flat_api.aio.models.tutteo_product import TutteoProduct +from flat_api.aio.models.user_azure_details import UserAzureDetails +from flat_api.aio.models.user_community_profile_links import UserCommunityProfileLinks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetails(BaseModel): + """ + User details + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + bio: Optional[StrictStr] = Field(default=None, description="User's biography") + registration_date: Optional[datetime] = Field(default=None, description="Date the user signed up", alias="registrationDate") + liked_scores_count: Optional[StrictInt] = Field(default=None, description="Number of the scores liked by the user", alias="likedScoresCount") + followers_count: Optional[StrictInt] = Field(default=None, description="Number of followers the user has", alias="followersCount") + following_count: Optional[StrictInt] = Field(default=None, description="Number of people the user follows", alias="followingCount") + owned_public_scores_count: Optional[StrictInt] = Field(default=None, description="Number of public scores the user owns", alias="ownedPublicScoresCount") + all_public_scores_count: Optional[StrictInt] = Field(default=None, description="Total number of public scores the user participates in (owned + joined)", alias="allPublicScoresCount") + likes_count: Optional[StrictInt] = Field(default=None, description="Number of likes on the user published scores", alias="likesCount") + plays_count: Optional[StrictInt] = Field(default=None, description="Number of plays on the user published scores", alias="playsCount") + cover_picture: Optional[StrictStr] = Field(default=None, description="Cover picture (background) for the profile", alias="coverPicture") + profile_theme: Optional[StrictStr] = Field(default=None, description="Theme (background) for the profile", alias="profileTheme") + links: Optional[UserCommunityProfileLinks] = None + is_email_verified: Optional[StrictBool] = Field(default=None, description="Whether the user's email address has been verified", alias="isEmailVerified") + azure_details: Optional[UserAzureDetails] = Field(default=None, alias="azureDetails") + private_profile: Optional[StrictBool] = Field(default=None, description="Whether this user profile is private (individual accounts only)", alias="privateProfile") + locale: Optional[StrictStr] = Field(default='en', description="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` ") + groups: Optional[List[StrictStr]] = Field(default=None, description="For Flat for Education accounts, list of Group identifiers the user is part of.") + picture_file: Optional[StrictStr] = Field(default=None, description="The ID of the user profile picture", alias="pictureFile") + cover_picture_file: Optional[StrictStr] = Field(default=None, description="The ID of the user profile cover picture", alias="coverPictureFile") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "bio", "registrationDate", "likedScoresCount", "followersCount", "followingCount", "ownedPublicScoresCount", "allPublicScoresCount", "likesCount", "playsCount", "coverPicture", "profileTheme", "links", "isEmailVerified", "azureDetails", "privateProfile", "locale", "groups", "pictureFile", "coverPictureFile"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of azure_details + if self.azure_details: + _dict['azureDetails'] = self.azure_details.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if picture_file (nullable) is None + # and model_fields_set contains the field + if self.picture_file is None and "picture_file" in self.model_fields_set: + _dict['pictureFile'] = None + + # set to None if cover_picture_file (nullable) is None + # and model_fields_set contains the field + if self.cover_picture_file is None and "cover_picture_file" in self.model_fields_set: + _dict['coverPictureFile'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "bio": obj.get("bio"), + "registrationDate": obj.get("registrationDate"), + "likedScoresCount": obj.get("likedScoresCount"), + "followersCount": obj.get("followersCount"), + "followingCount": obj.get("followingCount"), + "ownedPublicScoresCount": obj.get("ownedPublicScoresCount"), + "allPublicScoresCount": obj.get("allPublicScoresCount"), + "likesCount": obj.get("likesCount"), + "playsCount": obj.get("playsCount"), + "coverPicture": obj.get("coverPicture"), + "profileTheme": obj.get("profileTheme"), + "links": UserCommunityProfileLinks.from_dict(obj["links"]) if obj.get("links") is not None else None, + "isEmailVerified": obj.get("isEmailVerified"), + "azureDetails": UserAzureDetails.from_dict(obj["azureDetails"]) if obj.get("azureDetails") is not None else None, + "privateProfile": obj.get("privateProfile"), + "locale": obj.get("locale") if obj.get("locale") is not None else 'en', + "groups": obj.get("groups"), + "pictureFile": obj.get("pictureFile"), + "coverPictureFile": obj.get("coverPictureFile") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_details_admin.py b/flat_api/aio/models/user_details_admin.py new file mode 100644 index 0000000..528642f --- /dev/null +++ b/flat_api/aio/models/user_details_admin.py @@ -0,0 +1,153 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.class_roles import ClassRoles +from flat_api.aio.models.organization_roles import OrganizationRoles +from flat_api.aio.models.tutteo_product import TutteoProduct +from flat_api.aio.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetailsAdmin(BaseModel): + """ + User details (view for organization teacher / admin) + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + email: Optional[StrictStr] = Field(default=None, description="Email of the user") + last_activity_date: Optional[datetime] = Field(default=None, description="Date of the last user activity", alias="lastActivityDate") + license: Optional[UserDetailsAdminAllOfLicense] = None + groups: Optional[List[StrictStr]] = Field(default=None, description="For Flat for Education accounts, list of Group identifiers the user is part of.") + is_edu_testing_student: Optional[StrictBool] = Field(default=None, description="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. ", alias="isEduTestingStudent") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "email", "lastActivityDate", "license", "groups", "isEduTestingStudent"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetailsAdmin from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of license + if self.license: + _dict['license'] = self.license.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetailsAdmin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "email": obj.get("email"), + "lastActivityDate": obj.get("lastActivityDate"), + "license": UserDetailsAdminAllOfLicense.from_dict(obj["license"]) if obj.get("license") is not None else None, + "groups": obj.get("groups"), + "isEduTestingStudent": obj.get("isEduTestingStudent") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_details_admin_all_of_license.py b/flat_api/aio/models/user_details_admin_all_of_license.py new file mode 100644 index 0000000..d53326c --- /dev/null +++ b/flat_api/aio/models/user_details_admin_all_of_license.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.license_mode import LicenseMode +from flat_api.aio.models.license_sources import LicenseSources +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetailsAdminAllOfLicense(BaseModel): + """ + Current active license of the user + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="ID of the current license") + expiration_date: Optional[datetime] = Field(default=None, description="Date when the license expires", alias="expirationDate") + source: Optional[LicenseSources] = LicenseSources.ORDER + mode: Optional[LicenseMode] = None + active: Optional[StrictBool] = Field(default=None, description="Whether the license is currently active") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "expirationDate", "source", "mode", "active"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetailsAdminAllOfLicense from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetailsAdminAllOfLicense from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "expirationDate": obj.get("expirationDate"), + "source": obj.get("source") if obj.get("source") is not None else LicenseSources.ORDER, + "mode": obj.get("mode"), + "active": obj.get("active") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_public.py b/flat_api/aio/models/user_public.py new file mode 100644 index 0000000..73a3a31 --- /dev/null +++ b/flat_api/aio/models/user_public.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.class_roles import ClassRoles +from flat_api.aio.models.organization_roles import OrganizationRoles +from flat_api.aio.models.tutteo_product import TutteoProduct +from flat_api.aio.models.user_community_profile_links import UserCommunityProfileLinks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserPublic(BaseModel): + """ + Public User details + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + bio: Optional[StrictStr] = Field(default=None, description="User's biography") + registration_date: Optional[datetime] = Field(default=None, description="Date the user signed up", alias="registrationDate") + liked_scores_count: Optional[StrictInt] = Field(default=None, description="Number of the scores liked by the user", alias="likedScoresCount") + followers_count: Optional[StrictInt] = Field(default=None, description="Number of followers the user has", alias="followersCount") + following_count: Optional[StrictInt] = Field(default=None, description="Number of people the user follows", alias="followingCount") + owned_public_scores_count: Optional[StrictInt] = Field(default=None, description="Number of public scores the user owns", alias="ownedPublicScoresCount") + all_public_scores_count: Optional[StrictInt] = Field(default=None, description="Total number of public scores the user participates in (owned + joined)", alias="allPublicScoresCount") + likes_count: Optional[StrictInt] = Field(default=None, description="Number of likes on the user published scores", alias="likesCount") + plays_count: Optional[StrictInt] = Field(default=None, description="Number of plays on the user published scores", alias="playsCount") + cover_picture: Optional[StrictStr] = Field(default=None, description="Cover picture (background) for the profile", alias="coverPicture") + profile_theme: Optional[StrictStr] = Field(default=None, description="Theme (background) for the profile", alias="profileTheme") + links: Optional[UserCommunityProfileLinks] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "bio", "registrationDate", "likedScoresCount", "followersCount", "followingCount", "ownedPublicScoresCount", "allPublicScoresCount", "likesCount", "playsCount", "coverPicture", "profileTheme", "links"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserPublic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['links'] = self.links.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if cover_picture (nullable) is None + # and model_fields_set contains the field + if self.cover_picture is None and "cover_picture" in self.model_fields_set: + _dict['coverPicture'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserPublic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "bio": obj.get("bio"), + "registrationDate": obj.get("registrationDate"), + "likedScoresCount": obj.get("likedScoresCount"), + "followersCount": obj.get("followersCount"), + "followingCount": obj.get("followingCount"), + "ownedPublicScoresCount": obj.get("ownedPublicScoresCount"), + "allPublicScoresCount": obj.get("allPublicScoresCount"), + "likesCount": obj.get("likesCount"), + "playsCount": obj.get("playsCount"), + "coverPicture": obj.get("coverPicture"), + "profileTheme": obj.get("profileTheme"), + "links": UserCommunityProfileLinks.from_dict(obj["links"]) if obj.get("links") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_public_summary.py b/flat_api/aio/models/user_public_summary.py new file mode 100644 index 0000000..9d19e06 --- /dev/null +++ b/flat_api/aio/models/user_public_summary.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.aio.models.class_roles import ClassRoles +from flat_api.aio.models.organization_roles import OrganizationRoles +from flat_api.aio.models.tutteo_product import TutteoProduct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserPublicSummary(BaseModel): + """ + Public User details summary + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserPublicSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserPublicSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_signin_link.py b/flat_api/aio/models/user_signin_link.py new file mode 100644 index 0000000..193f529 --- /dev/null +++ b/flat_api/aio/models/user_signin_link.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserSigninLink(BaseModel): + """ + UserSigninLink + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL to use to sign in to this account") + token: Optional[StrictStr] = Field(default=None, description="Raw sign-in token, can be used to build custom URLs (e.g. deep links)") + expiration_date: Optional[datetime] = Field(default=None, description="Date when the link expires", alias="expirationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["url", "token", "expirationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSigninLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSigninLink from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "token": obj.get("token"), + "expirationDate": obj.get("expirationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/models/user_signin_link_creation.py b/flat_api/aio/models/user_signin_link_creation.py new file mode 100644 index 0000000..da7461b --- /dev/null +++ b/flat_api/aio/models/user_signin_link_creation.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserSigninLinkCreation(BaseModel): + """ + UserSigninLinkCreation + """ # noqa: E501 + destination_path: Optional[StrictStr] = Field(default='/', description="Path to redirect to after signin", alias="destinationPath") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destinationPath"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSigninLinkCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSigninLinkCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destinationPath": obj.get("destinationPath") if obj.get("destinationPath") is not None else '/' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/aio/rest.py b/flat_api/aio/rest.py new file mode 100644 index 0000000..51c6340 --- /dev/null +++ b/flat_api/aio/rest.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl +from typing import Any, Dict, Optional, Union + +import aiohttp +import aiohttp_retry + +from flat_api.aio.exceptions import ApiException, ApiValueError + +RESTResponseType = aiohttp.ClientResponse + +ALLOW_RETRY_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}) + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.read() + return self.data + + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers.get()`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + + # Keep a reference so factory methods (_create_pool_manager / _create_connector) + # and subclasses can read extension fields like trace_configs. + self.configuration = configuration + + # maxsize is number of requests to host that are allowed in parallel + self.maxsize = configuration.connection_pool_maxsize + + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) + if configuration.cert_file: + self.ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + retries = configuration.retries + if retries is None: + self._effective_retry_options = None + elif isinstance(retries, aiohttp_retry.RetryOptionsBase): + self._effective_retry_options = retries + elif isinstance(retries, int): + self._effective_retry_options = aiohttp_retry.ExponentialRetry( + attempts=retries, + factor=2.0, + start_timeout=0.1, + max_timeout=120.0 + ) + else: + self._effective_retry_options = None + + self.pool_manager: Optional[aiohttp.ClientSession] = None + self.retry_client: Optional[aiohttp_retry.RetryClient] = None + + async def close(self) -> None: + if self.pool_manager: + await self.pool_manager.close() + if self.retry_client is not None: + await self.retry_client.close() + + def _create_connector(self) -> aiohttp.TCPConnector: + """Build the TCPConnector used by the ClientSession. + + Override in a subclass to customize DNS resolver, keepalive, etc. + """ + kwargs: Dict[str, Any] = { + "limit": self.maxsize, + "ssl": self.ssl_context, + } + limit_per_host = getattr(self.configuration, "tcp_connector_limit_per_host", None) + if limit_per_host is not None: + kwargs["limit_per_host"] = limit_per_host + return aiohttp.TCPConnector(**kwargs) + + def _create_pool_manager(self) -> aiohttp.ClientSession: + """Build the aiohttp.ClientSession used as the connection pool. + + Override in a subclass to fully customize the session (e.g. attach + aiohttp.TraceConfig, swap json_serialize, etc.). Typed Configuration + fields (trace_configs / client_session_kwargs) are read via getattr + so older Configuration objects remain compatible. + """ + extra = getattr(self.configuration, "client_session_kwargs", None) + kwargs: Dict[str, Any] = { + "connector": self._create_connector(), + "trust_env": True, + } + trace_configs = getattr(self.configuration, "trace_configs", None) + if trace_configs is not None: + kwargs["trace_configs"] = trace_configs + if extra: + kwargs.update(extra) + return aiohttp.ClientSession(**kwargs) + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Execute request + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + if self.proxy: + args["proxy"] = self.proxy + if self.proxy_headers: + args["proxy_headers"] = self.proxy_headers + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + body = json.dumps(body) + if body is None and post_params: + body = json.dumps(dict(post_params)) + args["data"] = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': + args["data"] = aiohttp.FormData(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by aiohttp + del headers['Content-Type'] + data = aiohttp.FormData() + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + data.add_field( + k, + value=v[1], + filename=v[0], + content_type=v[2] + ) + else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) + data.add_field(k, v) + args["data"] = data + + # Pass a `bytes` or `str` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient] + + # https pool manager + if self.pool_manager is None: + self.pool_manager = self._create_pool_manager() + pool_manager = self.pool_manager + + if self._effective_retry_options is not None and method in ALLOW_RETRY_METHODS: + if self.retry_client is None: + self.retry_client = aiohttp_retry.RetryClient( + client_session=self.pool_manager, + retry_options=self._effective_retry_options + ) + pool_manager = self.retry_client + + r = await pool_manager.request(**args) + + return RESTResponse(r) diff --git a/flat_api/api/__init__.py b/flat_api/api/__init__.py index 2c80b55..c244aae 100644 --- a/flat_api/api/__init__.py +++ b/flat_api/api/__init__.py @@ -1,12 +1,14 @@ -from __future__ import absolute_import - # flake8: noqa # import apis into api package from flat_api.api.account_api import AccountApi from flat_api.api.class_api import ClassApi from flat_api.api.collection_api import CollectionApi +from flat_api.api.edu_resources_api import EduResourcesApi from flat_api.api.group_api import GroupApi +from flat_api.api.omr_api import OMRApi from flat_api.api.organization_api import OrganizationApi from flat_api.api.score_api import ScoreApi +from flat_api.api.task_api import TaskApi from flat_api.api.user_api import UserApi + diff --git a/flat_api/api/account_api.py b/flat_api/api/account_api.py index 8d72654..a23b6a1 100644 --- a/flat_api/api/account_api.py +++ b/flat_api/api/account_api.py @@ -1,125 +1,305 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import -import re # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -# python 2 and python 3 compatibility library -import six +from pydantic import Field, StrictBool +from typing import Optional +from typing_extensions import Annotated +from flat_api.models.user_details import UserDetails -from flat_api.api_client import ApiClient +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType -class AccountApi(object): - """NOTE: This class is auto generated by the swagger code generator program. +class AccountApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def get_authenticated_user(self, **kwargs): # noqa: E501 - """Get current user profile # noqa: E501 - - Get details about the current authenticated User. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_authenticated_user(async=True) - >>> result = thread.get() - - :param async bool - :return: UserDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_authenticated_user_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_authenticated_user_with_http_info(**kwargs) # noqa: E501 - return data - - def get_authenticated_user_with_http_info(self, **kwargs): # noqa: E501 - """Get current user profile # noqa: E501 - - Get details about the current authenticated User. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_authenticated_user_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :return: UserDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_authenticated_user" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/me', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='UserDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + + @validate_call + def get_authenticated_user( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetails: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_authenticated_user_with_http_info( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetails]: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_authenticated_user_without_preload_content( + self, + only_id: Annotated[Optional[StrictBool], Field(description="Only return the user id")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get current user account + + Get details about the current authenticated User. + + :param only_id: Only return the user id + :type only_id: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authenticated_user_serialize( + only_id=only_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_authenticated_user_serialize( + self, + only_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if only_id is not None: + + _query_params.append(('onlyId', only_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/me', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/class_api.py b/flat_api/api/class_api.py index b91d1f2..4a33bf9 100644 --- a/flat_api/api/class_api.py +++ b/flat_api/api/class_api.py @@ -1,2013 +1,9485 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from flat_api.api_client import ApiClient - + Generated by OpenAPI Generator (https://openapi-generator.tech) -class ClassApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.models.assignment import Assignment +from flat_api.models.assignment_copy import AssignmentCopy +from flat_api.models.assignment_copy_response import AssignmentCopyResponse +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.models.assignment_submission_history import AssignmentSubmissionHistory +from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.models.class_assignment import ClassAssignment +from flat_api.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.models.class_creation import ClassCreation +from flat_api.models.class_details import ClassDetails +from flat_api.models.class_update import ClassUpdate +from flat_api.models.user_details import UserDetails + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class ClassApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def activate_class(self, _class, **kwargs): # noqa: E501 - """Activate the class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.activate_class(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.activate_class_with_http_info(_class, **kwargs) # noqa: E501 - else: - (data) = self.activate_class_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def activate_class_with_http_info(self, _class, **kwargs): # noqa: E501 - """Activate the class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.activate_class_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_class" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `activate_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/activate', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def add_class_user(self, _class, user, **kwargs): # noqa: E501 - """Add a user to the class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_class_user(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.add_class_user_with_http_info(_class, user, **kwargs) # noqa: E501 - else: - (data) = self.add_class_user_with_http_info(_class, user, **kwargs) # noqa: E501 - return data - - def add_class_user_with_http_info(self, _class, user, **kwargs): # noqa: E501 - """Add a user to the class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_class_user_with_http_info(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'user'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_class_user" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `add_class_user`") # noqa: E501 - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `add_class_user`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/users/{user}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def archive_class(self, _class, **kwargs): # noqa: E501 - """Archive the class # noqa: E501 - - Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.archive_class(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.archive_class_with_http_info(_class, **kwargs) # noqa: E501 - else: - (data) = self.archive_class_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def archive_class_with_http_info(self, _class, **kwargs): # noqa: E501 - """Archive the class # noqa: E501 - - Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.archive_class_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method archive_class" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `archive_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/archive', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def copy_assignment(self, _class, assignment, body, **kwargs): # noqa: E501 - """Copy an assignment # noqa: E501 - - Copy an assignment to a specified class. If the original assignment has a due date in the past, this new assingment will be created without a due date. If the new class is synchronized with an external app (e.g. Google Classroom), the copied assignment will also be posted on the external app. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.copy_assignment(_class, assignment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param AssignmentCopy body: (required) - :return: Assignment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.copy_assignment_with_http_info(_class, assignment, body, **kwargs) # noqa: E501 - else: - (data) = self.copy_assignment_with_http_info(_class, assignment, body, **kwargs) # noqa: E501 - return data - - def copy_assignment_with_http_info(self, _class, assignment, body, **kwargs): # noqa: E501 - """Copy an assignment # noqa: E501 - - Copy an assignment to a specified class. If the original assignment has a due date in the past, this new assingment will be created without a due date. If the new class is synchronized with an external app (e.g. Google Classroom), the copied assignment will also be posted on the external app. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.copy_assignment_with_http_info(_class, assignment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param AssignmentCopy body: (required) - :return: Assignment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'assignment', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method copy_assignment" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `copy_assignment`") # noqa: E501 - # verify the required parameter 'assignment' is set - if ('assignment' not in params or - params['assignment'] is None): - raise ValueError("Missing the required parameter `assignment` when calling `copy_assignment`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `copy_assignment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'assignment' in params: - path_params['assignment'] = params['assignment'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments/{assignment}/copy', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Assignment', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_assignment(self, _class, **kwargs): # noqa: E501 - """Assignment creation # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_assignment(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param AssignmentCreation body: - :return: Assignment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_assignment_with_http_info(_class, **kwargs) # noqa: E501 - else: - (data) = self.create_assignment_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def create_assignment_with_http_info(self, _class, **kwargs): # noqa: E501 - """Assignment creation # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_assignment_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param AssignmentCreation body: - :return: Assignment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_assignment" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `create_assignment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Assignment', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_class(self, body, **kwargs): # noqa: E501 - """Create a new class # noqa: E501 - - 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 `POST /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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_class(body, async=True) - >>> result = thread.get() - - :param async bool - :param ClassCreation body: (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_class_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_class_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_class_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a new class # noqa: E501 - - 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 `POST /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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_class_with_http_info(body, async=True) - >>> result = thread.get() - - :param async bool - :param ClassCreation body: (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_class" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_submission(self, _class, assignment, body, **kwargs): # noqa: E501 - """Create or edit a submission # noqa: E501 - - Use this method as a student to create, update and submit a submission related to an assignment. Students can only set `attachments`, `studentComment` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_submission(_class, assignment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param AssignmentSubmissionUpdate body: (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_submission_with_http_info(_class, assignment, body, **kwargs) # noqa: E501 - else: - (data) = self.create_submission_with_http_info(_class, assignment, body, **kwargs) # noqa: E501 - return data - - def create_submission_with_http_info(self, _class, assignment, body, **kwargs): # noqa: E501 - """Create or edit a submission # noqa: E501 - - Use this method as a student to create, update and submit a submission related to an assignment. Students can only set `attachments`, `studentComment` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_submission_with_http_info(_class, assignment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param AssignmentSubmissionUpdate body: (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'assignment', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_submission" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `create_submission`") # noqa: E501 - # verify the required parameter 'assignment' is set - if ('assignment' not in params or - params['assignment'] is None): - raise ValueError("Missing the required parameter `assignment` when calling `create_submission`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_submission`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'assignment' in params: - path_params['assignment'] = params['assignment'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments/{assignment}/submissions', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssignmentSubmission', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_class_user(self, _class, user, **kwargs): # noqa: E501 - """Remove a user from the class # noqa: E501 - - This method can be used by a teacher to remove a user from the class, or by a student to leave the classroom. Warning: Removing a user from the class will remove the associated resources, including the submissions and feedback related to these submissions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_class_user(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_class_user_with_http_info(_class, user, **kwargs) # noqa: E501 - else: - (data) = self.delete_class_user_with_http_info(_class, user, **kwargs) # noqa: E501 - return data - - def delete_class_user_with_http_info(self, _class, user, **kwargs): # noqa: E501 - """Remove a user from the class # noqa: E501 - - This method can be used by a teacher to remove a user from the class, or by a student to leave the classroom. Warning: Removing a user from the class will remove the associated resources, including the submissions and feedback related to these submissions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_class_user_with_http_info(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'user'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_class_user" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `delete_class_user`") # noqa: E501 - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `delete_class_user`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/users/{user}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def edit_submission(self, _class, assignment, submission, body, **kwargs): # noqa: E501 - """Edit a submission # noqa: E501 - - Use this method as a teacher to update the different submission and give feedback. Teachers can only set `returnFeedback` # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_submission(_class, assignment, submission, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param str submission: Unique identifier of the submission (required) - :param AssignmentSubmissionUpdate body: (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.edit_submission_with_http_info(_class, assignment, submission, body, **kwargs) # noqa: E501 - else: - (data) = self.edit_submission_with_http_info(_class, assignment, submission, body, **kwargs) # noqa: E501 - return data - - def edit_submission_with_http_info(self, _class, assignment, submission, body, **kwargs): # noqa: E501 - """Edit a submission # noqa: E501 - - Use this method as a teacher to update the different submission and give feedback. Teachers can only set `returnFeedback` # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_submission_with_http_info(_class, assignment, submission, body, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param str submission: Unique identifier of the submission (required) - :param AssignmentSubmissionUpdate body: (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'assignment', 'submission', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method edit_submission" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `edit_submission`") # noqa: E501 - # verify the required parameter 'assignment' is set - if ('assignment' not in params or - params['assignment'] is None): - raise ValueError("Missing the required parameter `assignment` when calling `edit_submission`") # noqa: E501 - # verify the required parameter 'submission' is set - if ('submission' not in params or - params['submission'] is None): - raise ValueError("Missing the required parameter `submission` when calling `edit_submission`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `edit_submission`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'assignment' in params: - path_params['assignment'] = params['assignment'] # noqa: E501 - if 'submission' in params: - path_params['submission'] = params['submission'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments/{assignment}/submissions/{submission}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssignmentSubmission', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def enroll_class(self, enrollment_code, **kwargs): # noqa: E501 - """Join a class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.enroll_class(enrollment_code, async=True) - >>> result = thread.get() - - :param async bool - :param str enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.enroll_class_with_http_info(enrollment_code, **kwargs) # noqa: E501 - else: - (data) = self.enroll_class_with_http_info(enrollment_code, **kwargs) # noqa: E501 - return data - - def enroll_class_with_http_info(self, enrollment_code, **kwargs): # noqa: E501 - """Join a class # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.enroll_class_with_http_info(enrollment_code, async=True) - >>> result = thread.get() - - :param async bool - :param str enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['enrollment_code'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method enroll_class" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'enrollment_code' is set - if ('enrollment_code' not in params or - params['enrollment_code'] is None): - raise ValueError("Missing the required parameter `enrollment_code` when calling `enroll_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'enrollment_code' in params: - path_params['enrollmentCode'] = params['enrollment_code'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/enroll/{enrollmentCode}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_class(self, _class, **kwargs): # noqa: E501 - """Get the details of a single class # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_class(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_class_with_http_info(_class, **kwargs) # noqa: E501 + + @validate_call + def activate_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def activate_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def activate_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _activate_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/activate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def add_class_user( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_class_user_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_class_user_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 their role in the Organization. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_class_user_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def archive_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def archive_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def archive_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Archive the assignment + + Archive the assignment + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _archive_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def archive_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def archive_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def archive_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Archive the class + + Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _archive_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def copy_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def copy_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def copy_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentCopyResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_assignment_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_class_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def get_class_with_http_info(self, _class, **kwargs): # noqa: E501 - """Get the details of a single class # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_class_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_class" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `get_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_submissions(self, score, **kwargs): # noqa: E501 - """List submissions related to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_submissions(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_submissions_with_http_info(score, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/copy', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_class( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_class_with_http_info( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_class_without_preload_content( + self, + body: ClassCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 classroom 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 be 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. + + :param body: (required) + :type body: ClassCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_class_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_score_submissions_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_submissions_with_http_info(self, score, **kwargs): # noqa: E501 - """List submissions related to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_submissions_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_submissions" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_submissions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/submissions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[AssignmentSubmission]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_submission(self, _class, assignment, submission, **kwargs): # noqa: E501 - """Get a student submission # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_submission(_class, assignment, submission, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param str submission: Unique identifier of the submission (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_submission_with_http_info(_class, assignment, submission, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_class_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_class_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_class_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_class_assignment_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_class_assignment_serialize( + self, + var_class, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_submission_with_http_info(_class, assignment, submission, **kwargs) # noqa: E501 - return data - - def get_submission_with_http_info(self, _class, assignment, submission, **kwargs): # noqa: E501 - """Get a student submission # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_submission_with_http_info(_class, assignment, submission, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :param str submission: Unique identifier of the submission (required) - :return: AssignmentSubmission - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'assignment', 'submission'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_submission" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `get_submission`") # noqa: E501 - # verify the required parameter 'assignment' is set - if ('assignment' not in params or - params['assignment'] is None): - raise ValueError("Missing the required parameter `assignment` when calling `get_submission`") # noqa: E501 - # verify the required parameter 'submission' is set - if ('submission' not in params or - params['submission'] is None): - raise ValueError("Missing the required parameter `submission` when calling `get_submission`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'assignment' in params: - path_params['assignment'] = params['assignment'] # noqa: E501 - if 'submission' in params: - path_params['submission'] = params['submission'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments/{assignment}/submissions/{submission}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssignmentSubmission', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_submissions(self, _class, assignment, **kwargs): # noqa: E501 - """List the students' submissions # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_submissions(_class, assignment, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_submissions_with_http_info(_class, assignment, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`, `playback`, `exercisesIds` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_submission_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_submission_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_submissions_with_http_info(_class, assignment, **kwargs) # noqa: E501 - return data - - def get_submissions_with_http_info(self, _class, assignment, **kwargs): # noqa: E501 - """List the students' submissions # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_submissions_with_http_info(_class, assignment, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str assignment: Unique identifier of the assignment (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'assignment'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_submissions" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `get_submissions`") # noqa: E501 - # verify the required parameter 'assignment' is set - if ('assignment' not in params or - params['assignment'] is None): - raise ValueError("Missing the required parameter `assignment` when calling `get_submissions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'assignment' in params: - path_params['assignment'] = params['assignment'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments/{assignment}/submissions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[AssignmentSubmission]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_assignments(self, _class, **kwargs): # noqa: E501 - """Assignments listing # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_assignments(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: list[Assignment] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_assignments_with_http_info(_class, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_test_student_account( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetails: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_test_student_account_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetails]: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_test_student_account_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + reset: Annotated[Optional[StrictBool], Field(description="If true, the testing account will be re-created. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a test student account + + Test student accounts can be created by teachers and admins to try out 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param reset: If true, the testing account will be re-created. + :type reset: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_test_student_account_serialize( + var_class=var_class, + reset=reset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_test_student_account_serialize( + self, + var_class, + reset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + if reset is not None: + + _query_params.append(('reset', reset)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/testStudent', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_class_user( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_class_user_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_class_user_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_class_user_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_class_user_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Reset a submission + + Use this method as a teacher to reset a submission and allow the student to start the assignment over + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_submission_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_submission_comment_serialize( + self, + var_class, + assignment, + submission, + comment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def edit_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def edit_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def edit_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + body: AssignmentSubmissionUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Edit a submission + + Use this method as a teacher to update a submission and give feedback. Teachers can only set `return`, `draftGrade` and `grade`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param body: (required) + :type body: AssignmentSubmissionUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_submission_serialize( + self, + var_class, + assignment, + submission, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_assignments_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def list_assignments_with_http_info(self, _class, **kwargs): # noqa: E501 - """Assignments listing # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_assignments_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: list[Assignment] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_assignments" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `list_assignments`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/assignments', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Assignment]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_class_student_submissions(self, _class, user, **kwargs): # noqa: E501 - """List the submissions for a student # noqa: E501 - - Use this method as a teacher to list all the assignment submissions sent by a student of the class # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_class_student_submissions(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_class_student_submissions_with_http_info(_class, user, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def enroll_class( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enroll_class_with_http_info( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enroll_class_without_preload_content( + self, + enrollment_code: Annotated[StrictStr, Field(description="The enrollment code, available to the teacher in `ClassDetails` ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Join a class + + Use this method to join a class using an enrollment code given by one of the teachers 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 their role in the organization. + + :param enrollment_code: The enrollment code, available to the teacher in `ClassDetails` (required) + :type enrollment_code: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enroll_class_serialize( + enrollment_code=enrollment_code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enroll_class_serialize( + self, + enrollment_code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if enrollment_code is not None: + _path_params['enrollmentCode'] = enrollment_code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/enroll/{enrollmentCode}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def export_submissions_reviews_as_csv( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def export_submissions_reviews_as_csv_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def export_submissions_reviews_as_csv_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """CSV Grades exports + + Export list of submissions grades to a CSV file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_csv_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_submissions_reviews_as_csv_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/csv' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/csv', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def export_submissions_reviews_as_excel( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def export_submissions_reviews_as_excel_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def export_submissions_reviews_as_excel_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Excel Grades exports + + Export list of submissions grades to an Excel file + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_submissions_reviews_as_excel_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_submissions_reviews_as_excel_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/excel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the details of a single class + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_submissions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_submissions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_submissions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_submissions_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_submission( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmission: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_submission_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmission]: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_submission_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a student submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmission", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_submission_comments( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmissionComment]: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_submission_comments_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmissionComment]]: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_submission_comments_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the feedback comments of a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_comments_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionComment]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_comments_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_submission_history( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmissionHistory]: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_submission_history_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmissionHistory]]: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_submission_history_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the history of the submission + + For teachers only. Returns a detailed history of the submission. This currently includes state and grade histories. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submission_history_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmissionHistory]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submission_history_serialize( + self, + var_class, + assignment, + submission, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/history', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_submissions( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[AssignmentSubmission]: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_submissions_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[AssignmentSubmission]]: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_submissions_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the students' submissions + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_submissions_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_submissions_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments/{assignment}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_assignments( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ClassAssignment]: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_assignments_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ClassAssignment]]: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_assignments_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assignments listing + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_assignments_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassAssignment]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_assignments_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_class_student_submissions( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_class_student_submissions_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_class_student_submissions_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + user: Annotated[StrictStr, Field(description="Unique identifier of the user")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param user: Unique identifier of the user (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_class_student_submissions_serialize( + var_class=var_class, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_class_student_submissions_serialize( + self, + var_class, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes/{class}/students/{user}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_classes( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ClassDetails]: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_classes_with_http_info( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ClassDetails]]: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_classes_without_preload_content( + self, + state: Annotated[Optional[StrictStr], Field(description="Filter the classes by state")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the classes available for the current user + + + :param state: Filter the classes by state + :type state: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_classes_serialize( + state=state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ClassDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_classes_serialize( + self, + state, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if state is not None: + + _query_params.append(('state', state)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/classes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def post_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmissionComment: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def post_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmissionComment]: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def post_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_submission_comment_serialize( + self, + var_class, + assignment, + submission, + assignment_submission_comment_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_submission_comment_creation is not None: + _body_params = assignment_submission_comment_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_class_student_submissions_with_http_info(_class, user, **kwargs) # noqa: E501 - return data - - def list_class_student_submissions_with_http_info(self, _class, user, **kwargs): # noqa: E501 - """List the submissions for a student # noqa: E501 - - Use this method as a teacher to list all the assignment submissions sent by a student of the class # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_class_student_submissions_with_http_info(_class, user, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param str user: Unique identifier of the user (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'user'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_class_student_submissions" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `list_class_student_submissions`") # noqa: E501 - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `list_class_student_submissions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/students/{user}/submissions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[AssignmentSubmission]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_classes(self, **kwargs): # noqa: E501 - """List the classes available for the current user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_classes(async=True) - >>> result = thread.get() - - :param async bool - :param str state: Filter the classes by state - :return: list[ClassDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_classes_with_http_info(**kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def unarchive_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def unarchive_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def unarchive_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unarchive the assignment. + + Mark the assignment as `active`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_assignment_serialize( + var_class=var_class, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _unarchive_assignment_serialize( + self, + var_class, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/assignments/{assignment}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def unarchive_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def unarchive_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def unarchive_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unarchive the class + + Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will automatically be updated. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_class_serialize( + var_class=var_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _unarchive_class_serialize( + self, + var_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/classes/{class}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_class( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClassDetails: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_class_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClassDetails]: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_class_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + body: Annotated[ClassUpdate, Field(description="Details of the Class")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the class + + Update the meta information of the class + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param body: Details of the Class (required) + :type body: ClassUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_serialize( + var_class=var_class, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassDetails", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_class_serialize( + self, + var_class, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_classes_with_http_info(**kwargs) # noqa: E501 - return data - - def list_classes_with_http_info(self, **kwargs): # noqa: E501 - """List the classes available for the current user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_classes_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param str state: Filter the classes by state - :return: list[ClassDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['state'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_classes" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'state' in params: - query_params.append(('state', params['state'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ClassDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def unarchive_class(self, _class, **kwargs): # noqa: E501 - """Unarchive the class # noqa: E501 - - Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.unarchive_class(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.unarchive_class_with_http_info(_class, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_class_assignment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_class_assignment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_class_assignment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + body: ClassAssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param body: (required) + :type body: ClassAssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_class_assignment_serialize( + var_class=var_class, + assignment=assignment, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_class_assignment_serialize( + self, + var_class, + assignment, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.unarchive_class_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def unarchive_class_with_http_info(self, _class, **kwargs): # noqa: E501 - """Unarchive the class # noqa: E501 - - Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.unarchive_class_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method unarchive_class" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `unarchive_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}/archive', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_class(self, _class, **kwargs): # noqa: E501 - """Update the class # noqa: E501 - - Update the meta information of the class # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_class(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param ClassUpdate body: Details of the Class - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_class_with_http_info(_class, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_submission_comment( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AssignmentSubmissionComment: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_submission_comment_with_http_info( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AssignmentSubmissionComment]: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_submission_comment_without_preload_content( + self, + var_class: Annotated[StrictStr, Field(description="Unique identifier of the class")], + assignment: Annotated[StrictStr, Field(description="Unique identifier of the assignment")], + submission: Annotated[StrictStr, Field(description="Unique identifier of the submission")], + comment: Annotated[StrictStr, Field(description="Unique identifier of the comment")], + assignment_submission_comment_creation: AssignmentSubmissionCommentCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a feedback comment to a submission + + + :param var_class: Unique identifier of the class (required) + :type var_class: str + :param assignment: Unique identifier of the assignment (required) + :type assignment: str + :param submission: Unique identifier of the submission (required) + :type submission: str + :param comment: Unique identifier of the comment (required) + :type comment: str + :param assignment_submission_comment_creation: (required) + :type assignment_submission_comment_creation: AssignmentSubmissionCommentCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_submission_comment_serialize( + var_class=var_class, + assignment=assignment, + submission=submission, + comment=comment, + assignment_submission_comment_creation=assignment_submission_comment_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AssignmentSubmissionComment", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_submission_comment_serialize( + self, + var_class, + assignment, + submission, + comment, + assignment_submission_comment_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if var_class is not None: + _path_params['class'] = var_class + if assignment is not None: + _path_params['assignment'] = assignment + if submission is not None: + _path_params['submission'] = submission + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_submission_comment_creation is not None: + _body_params = assignment_submission_comment_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.update_class_with_http_info(_class, **kwargs) # noqa: E501 - return data - - def update_class_with_http_info(self, _class, **kwargs): # noqa: E501 - """Update the class # noqa: E501 - - Update the meta information of the class # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_class_with_http_info(_class, async=True) - >>> result = thread.get() - - :param async bool - :param str _class: Unique identifier of the class (required) - :param ClassUpdate body: Details of the Class - :return: ClassDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['_class', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_class" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter '_class' is set - if ('_class' not in params or - params['_class'] is None): - raise ValueError("Missing the required parameter `_class` when calling `update_class`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if '_class' in params: - path_params['class'] = params['_class'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/classes/{class}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ClassDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/classes/{class}/assignments/{assignment}/submissions/{submission}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/collection_api.py b/flat_api/api/collection_api.py index 17aa8ee..b49455b 100644 --- a/flat_api/api/collection_api.py +++ b/flat_api/api/collection_api.py @@ -1,997 +1,2803 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import -import re # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -# python 2 and python 3 compatibility library -import six +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.models.collection import Collection +from flat_api.models.collection_creation import CollectionCreation +from flat_api.models.collection_modification import CollectionModification +from flat_api.models.flat_error_response import FlatErrorResponse +from flat_api.models.score_details import ScoreDetails -from flat_api.api_client import ApiClient +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType -class CollectionApi(object): - """NOTE: This class is auto generated by the swagger code generator program. +class CollectionApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def add_score_to_collection(self, collection, score, **kwargs): # noqa: E501 - """Add a score to the collection # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_to_collection(collection, score, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.add_score_to_collection_with_http_info(collection, score, **kwargs) # noqa: E501 - else: - (data) = self.add_score_to_collection_with_http_info(collection, score, **kwargs) # noqa: E501 - return data - - def add_score_to_collection_with_http_info(self, collection, score, **kwargs): # noqa: E501 - """Add a score to the collection # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_to_collection_with_http_info(collection, score, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection', 'score', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_score_to_collection" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `add_score_to_collection`") # noqa: E501 - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `add_score_to_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}/scores/{score}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_collection(self, body, **kwargs): # noqa: E501 - """Create a new collection # noqa: E501 - - This method will create a new collection and add it to your `root` collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_collection(body, async=True) - >>> result = thread.get() - - :param async bool - :param CollectionCreation body: (required) - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_collection_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a new collection # noqa: E501 - - This method will create a new collection and add it to your `root` collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_collection_with_http_info(body, async=True) - >>> result = thread.get() - - :param async bool - :param CollectionCreation body: (required) - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_collection" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Collection', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_collection(self, collection, **kwargs): # noqa: E501 - """Delete the collection # noqa: E501 - - This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_collection(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_collection_with_http_info(collection, **kwargs) # noqa: E501 - else: - (data) = self.delete_collection_with_http_info(collection, **kwargs) # noqa: E501 - return data - - def delete_collection_with_http_info(self, collection, **kwargs): # noqa: E501 - """Delete the collection # noqa: E501 - - This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_collection_with_http_info(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_collection" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `delete_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_score_from_collection(self, collection, score, **kwargs): # noqa: E501 - """Delete a score from the collection # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_from_collection(collection, score, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_score_from_collection_with_http_info(collection, score, **kwargs) # noqa: E501 - else: - (data) = self.delete_score_from_collection_with_http_info(collection, score, **kwargs) # noqa: E501 - return data - - def delete_score_from_collection_with_http_info(self, collection, score, **kwargs): # noqa: E501 - """Delete a score from the collection # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_from_collection_with_http_info(collection, score, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection', 'score'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_score_from_collection" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `delete_score_from_collection`") # noqa: E501 - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `delete_score_from_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}/scores/{score}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def edit_collection(self, collection, **kwargs): # noqa: E501 - """Update a collection's metadata # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_collection(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 CollectionModification body: - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.edit_collection_with_http_info(collection, **kwargs) # noqa: E501 - else: - (data) = self.edit_collection_with_http_info(collection, **kwargs) # noqa: E501 - return data - - def edit_collection_with_http_info(self, collection, **kwargs): # noqa: E501 - """Update a collection's metadata # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_collection_with_http_info(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 CollectionModification body: - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method edit_collection" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `edit_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Collection', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_collection(self, collection, **kwargs): # noqa: E501 - """Get collection details # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_collection(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str 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. - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_collection_with_http_info(collection, **kwargs) # noqa: E501 + + @validate_call + def add_score_to_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_score_to_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_score_to_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_to_collection_serialize( + collection=collection, + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_to_collection_serialize( + self, + collection, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_collection_with_http_info(collection, **kwargs) # noqa: E501 - return data - - def get_collection_with_http_info(self, collection, **kwargs): # noqa: E501 - """Get collection details # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_collection_with_http_info(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str 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. - :return: Collection - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_collection" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `get_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Collection', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_collection_scores(self, collection, **kwargs): # noqa: E501 - """List the scores contained in a collection # noqa: E501 - - Use this method to list the scores contained in a collection. If no sort option is provided, the scores are sorted by `modificationDate` `desc`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_collection_scores(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str 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. - :param str sort: Sort - :param str direction: Sort direction - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_collection_scores_with_http_info(collection, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/collections/{collection}/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_collection( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_collection_with_http_info( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_collection_without_preload_content( + self, + body: CollectionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new collection + + This method will create a new collection in your account. + + :param body: (required) + :type body: CollectionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_collection_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_collection_scores_with_http_info(collection, **kwargs) # noqa: E501 - return data - - def list_collection_scores_with_http_info(self, collection, **kwargs): # noqa: E501 - """List the scores contained in a collection # noqa: E501 - - Use this method to list the scores contained in a collection. If no sort option is provided, the scores are sorted by `modificationDate` `desc`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_collection_scores_with_http_info(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 str 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. - :param str sort: Sort - :param str direction: Sort direction - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection', 'sharing_key', 'sort', 'direction', 'limit', 'next', 'previous'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_collection_scores" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `list_collection_scores`") # noqa: E501 - - if 'limit' in params and params['limit'] > 100: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_collection_scores`, must be a value less than or equal to `100`") # noqa: E501 - if 'limit' in params and params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_collection_scores`, must be a value greater than or equal to `1`") # noqa: E501 - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - if 'sort' in params: - query_params.append(('sort', params['sort'])) # noqa: E501 - if 'direction' in params: - query_params.append(('direction', params['direction'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'next' in params: - query_params.append(('next', params['next'])) # noqa: E501 - if 'previous' in params: - query_params.append(('previous', params['previous'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}/scores', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_collections(self, **kwargs): # noqa: E501 - """List the collections # noqa: E501 - - Use this method to list the user's collections contained in `parent` (by default in the `root` collection). If no sort option is provided, the collections are sorted by `creationDate` `desc`. Note that this method will not include the `parent` collection in the listing. For example, if you need the details of the `root` collection, you can use `GET /v2/collections/root`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_collections(async=True) - >>> result = thread.get() - - :param async bool - :param str 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`. - :param str sort: Sort - :param str direction: Sort direction - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[Collection] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_collections_with_http_info(**kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_collection( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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 ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the collection + + This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. + + :param 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) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_collection_serialize( + self, + collection, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_score_from_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_score_from_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_score_from_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a score from the collection + + This method will delete a score from the collection. Unlike [`DELETE /scores/{score}`](#operation/deleteScore), this 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. + + :param 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) + :type collection: str + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_from_collection_serialize( + collection=collection, + score=score, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_from_collection_serialize( + self, + collection, + score, + event_properties, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + if score is not None: + _path_params['score'] = score + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_collections_with_http_info(**kwargs) # noqa: E501 - return data - - def list_collections_with_http_info(self, **kwargs): # noqa: E501 - """List the collections # noqa: E501 - - Use this method to list the user's collections contained in `parent` (by default in the `root` collection). If no sort option is provided, the collections are sorted by `creationDate` `desc`. Note that this method will not include the `parent` collection in the listing. For example, if you need the details of the `root` collection, you can use `GET /v2/collections/root`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_collections_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param str 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`. - :param str sort: Sort - :param str direction: Sort direction - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[Collection] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['parent', 'sort', 'direction', 'limit', 'next', 'previous'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_collections" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] ) - params[key] = val - del params['kwargs'] - - if 'limit' in params and params['limit'] > 100: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_collections`, must be a value less than or equal to `100`") # noqa: E501 - if 'limit' in params and params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_collections`, must be a value greater than or equal to `1`") # noqa: E501 - collection_formats = {} - - path_params = {} - - query_params = [] - if 'parent' in params: - query_params.append(('parent', params['parent'])) # noqa: E501 - if 'sort' in params: - query_params.append(('sort', params['sort'])) # noqa: E501 - if 'direction' in params: - query_params.append(('direction', params['direction'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'next' in params: - query_params.append(('next', params['next'])) # noqa: E501 - if 'previous' in params: - query_params.append(('previous', params['previous'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Collection]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def untrash_collection(self, collection, **kwargs): # noqa: E501 - """Untrash a collection # noqa: E501 - - This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.untrash_collection(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.untrash_collection_with_http_info(collection, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/collections/{collection}/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def edit_collection( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def edit_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def edit_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: CollectionModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a collection's metadata + + + :param 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) + :type collection: str + :param body: (required) + :type body: CollectionModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_collection_serialize( + collection=collection, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_collection_serialize( + self, + collection, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.untrash_collection_with_http_info(collection, **kwargs) # noqa: E501 - return data - - def untrash_collection_with_http_info(self, collection, **kwargs): # noqa: E501 - """Untrash a collection # noqa: E501 - - This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.untrash_collection_with_http_info(collection, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['collection'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method untrash_collection" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'collection' is set - if ('collection' not in params or - params['collection'] is None): - raise ValueError("Missing the required parameter `collection` when calling `untrash_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'collection' in params: - path_params['collection'] = params['collection'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/collections/{collection}/untrash', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_collection( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection details + + + :param 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) + :type collection: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_serialize( + collection=collection, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_collection_serialize( + self, + collection, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections/{collection}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_collection_scores( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_collection_scores_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_collection_scores_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param 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) + :type collection: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collection_scores_serialize( + collection=collection, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_collection_scores_serialize( + self, + collection, + sort, + direction, + limit, + next, + previous, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections/{collection}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_collections( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_collections_with_http_info( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_collections_without_preload_content( + self, + parent: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param 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`. + :type parent: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_collections_serialize( + parent=parent, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Collection]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_collections_serialize( + self, + parent, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def untrash_collection( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FlatErrorResponse: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def untrash_collection_with_http_info( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FlatErrorResponse]: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def untrash_collection_without_preload_content( + self, + collection: Annotated[StrictStr, Field(description="Unique identifier of the collection.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Untrash a collection + + **DEPRECATED** This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. + + :param collection: Unique identifier of the collection. (required) + :type collection: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /collections/{collection}/untrash is deprecated.", DeprecationWarning) + + _param = self._untrash_collection_serialize( + collection=collection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '400': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _untrash_collection_serialize( + self, + collection, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection is not None: + _path_params['collection'] = collection + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/collections/{collection}/untrash', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/edu_resources_api.py b/flat_api/api/edu_resources_api.py new file mode 100644 index 0000000..648963c --- /dev/null +++ b/flat_api/api/edu_resources_api.py @@ -0,0 +1,3509 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.models.assignment import Assignment +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.assignment_update import AssignmentUpdate +from flat_api.models.class_assignment import ClassAssignment +from flat_api.models.edu_library import EduLibrary +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_copy import EduResourceCopy +from flat_api.models.edu_resource_creation import EduResourceCreation +from flat_api.models.edu_resource_lti_link import EduResourceLtiLink +from flat_api.models.edu_resource_move import EduResourceMove +from flat_api.models.edu_resource_update import EduResourceUpdate +from flat_api.models.edu_resource_use_in_class import EduResourceUseInClass +from flat_api.models.grade import Grade +from flat_api.models.teaching_theme import TeachingTheme + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class EduResourcesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def copy_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def copy_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def copy_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_copy: EduResourceCopy, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Copy an education resource to a Resource Library + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_copy: (required) + :type edu_resource_copy: EduResourceCopy + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_serialize( + resource=resource, + edu_resource_copy=edu_resource_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_edu_resource_serialize( + self, + resource, + edu_resource_copy, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_copy is not None: + _body_params = edu_resource_copy + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/copy', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def copy_edu_resource_to_demo_class( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def copy_edu_resource_to_demo_class_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def copy_edu_resource_to_demo_class_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._copy_edu_resource_to_demo_class_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _copy_edu_resource_to_demo_class_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/copyToDemoClass', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_edu_resource( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_edu_resource_with_http_info( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_edu_resource_without_preload_content( + self, + edu_resource_creation: EduResourceCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new education resource + + + :param edu_resource_creation: (required) + :type edu_resource_creation: EduResourceCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_serialize( + edu_resource_creation=edu_resource_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_edu_resource_serialize( + self, + edu_resource_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_creation is not None: + _body_params = edu_resource_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_edu_resource_lti_link( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_edu_resource_lti_link_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_edu_resource_lti_link_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_edu_resource_lti_link_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResourceLtiLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_edu_resource_lti_link_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/createLtiLink', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_edu_resource_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_edu_resource_serialize( + resource=resource, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_edu_resource_serialize( + self, + resource, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_edu_libraries( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[EduLibrary]: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_edu_libraries_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[EduLibrary]]: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_edu_libraries_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the education libraries + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_libraries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduLibrary]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_edu_libraries_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources/libraries', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_edu_resources( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[EduResource]: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_edu_resources_with_http_info( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[EduResource]]: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_edu_resources_without_preload_content( + self, + parent: Annotated[Optional[StrictStr], Field(description="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 ")] = None, + without_subfolders_resources: Annotated[Optional[StrictBool], Field(description="For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. ")] = None, + type: Annotated[Optional[StrictStr], Field(description="Filter the returned resources by type ")] = None, + subjects: Annotated[Optional[List[TeachingTheme]], Field(description="Filter the returned resources by subjects ")] = None, + assignment_types: Annotated[Optional[List[AssignmentType]], Field(description="Filter the returned resources by assignment types ")] = None, + grades: Annotated[Optional[List[Grade]], Field(description="Filter the returned resources by grades ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of resources that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List education resources in a library or folder + + + :param 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 + :type parent: str + :param without_subfolders_resources: For the `parent` = `organization`, do not include resources from subfolders. Resources from subfolders are included by default; set this to `true` to list only the direct children, for example in a picker. + :type without_subfolders_resources: bool + :param type: Filter the returned resources by type + :type type: str + :param subjects: Filter the returned resources by subjects + :type subjects: List[TeachingTheme] + :param assignment_types: Filter the returned resources by assignment types + :type assignment_types: List[AssignmentType] + :param grades: Filter the returned resources by grades + :type grades: List[Grade] + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of resources that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_edu_resources_serialize( + parent=parent, + without_subfolders_resources=without_subfolders_resources, + type=type, + subjects=subjects, + assignment_types=assignment_types, + grades=grades, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[EduResource]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_edu_resources_serialize( + self, + parent, + without_subfolders_resources, + type, + subjects, + assignment_types, + grades, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'subjects': 'multi', + 'assignmentTypes': 'multi', + 'grades': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + if without_subfolders_resources is not None: + + _query_params.append(('withoutSubfoldersResources', without_subfolders_resources)) + + if type is not None: + + _query_params.append(('type', type)) + + if subjects is not None: + + _query_params.append(('subjects', subjects)) + + if assignment_types is not None: + + _query_params.append(('assignmentTypes', assignment_types)) + + if grades is not None: + + _query_params.append(('grades', grades)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/eduResources', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def move_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def move_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def move_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_move: EduResourceMove, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Move an education resource + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_move: (required) + :type edu_resource_move: EduResourceMove + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._move_edu_resource_serialize( + resource=resource, + edu_resource_move=edu_resource_move, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _move_edu_resource_serialize( + self, + resource, + edu_resource_move, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_move is not None: + _body_params = edu_resource_move + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/move', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_edu_resource( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EduResource: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_edu_resource_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EduResource]: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_edu_resource_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_update: EduResourceUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an education resource metadata + + Update the metadata of a resource (e.g. its title). Use this method to rename education resources folders or assignments. + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_update: (required) + :type edu_resource_update: EduResourceUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_serialize( + resource=resource, + edu_resource_update=edu_resource_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EduResource", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_edu_resource_serialize( + self, + resource, + edu_resource_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_update is not None: + _body_params = edu_resource_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/eduResources/{resource}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_edu_resource_assignment( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignment: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_edu_resource_assignment_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignment]: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_edu_resource_assignment_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + assignment_update: AssignmentUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an education resource assignment + + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param assignment_update: (required) + :type assignment_update: AssignmentUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_edu_resource_assignment_serialize( + resource=resource, + assignment_update=assignment_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_edu_resource_assignment_serialize( + self, + resource, + assignment_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if assignment_update is not None: + _body_params = assignment_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/eduResources/{resource}/assignment', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def use_edu_resource_in_class( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def use_edu_resource_in_class_with_http_info( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def use_edu_resource_in_class_without_preload_content( + self, + resource: Annotated[StrictStr, Field(description="Unique identifier of the resource")], + edu_resource_use_in_class: EduResourceUseInClass, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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.). + + :param resource: Unique identifier of the resource (required) + :type resource: str + :param edu_resource_use_in_class: (required) + :type edu_resource_use_in_class: EduResourceUseInClass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._use_edu_resource_in_class_serialize( + resource=resource, + edu_resource_use_in_class=edu_resource_use_in_class, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ClassAssignment", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _use_edu_resource_in_class_serialize( + self, + resource, + edu_resource_use_in_class, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if resource is not None: + _path_params['resource'] = resource + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if edu_resource_use_in_class is not None: + _body_params = edu_resource_use_in_class + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/eduResources/{resource}/useInClass', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/group_api.py b/flat_api/api/group_api.py index bb3dc7a..4baacd7 100644 --- a/flat_api/api/group_api.py +++ b/flat_api/api/group_api.py @@ -1,331 +1,2629 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import -import re # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -# python 2 and python 3 compatibility library -import six +from pydantic import Field, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.models.add_group_user200_response import AddGroupUser200Response +from flat_api.models.add_group_user_request import AddGroupUserRequest +from flat_api.models.group_creation import GroupCreation +from flat_api.models.group_details import GroupDetails +from flat_api.models.rename_group_request import RenameGroupRequest +from flat_api.models.score_details import ScoreDetails +from flat_api.models.user_public import UserPublic -from flat_api.api_client import ApiClient +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType -class GroupApi(object): - """NOTE: This class is auto generated by the swagger code generator program. +class GroupApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def get_group_details(self, group, **kwargs): # noqa: E501 - """Get group information # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_details(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :return: GroupDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_group_details_with_http_info(group, **kwargs) # noqa: E501 + + @validate_call + def add_group_user( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AddGroupUser200Response: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_group_user_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AddGroupUser200Response]: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_group_user_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + add_group_user_request: AddGroupUserRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a student to a group + + Add a student to the specified group (must be in the same class) + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param add_group_user_request: (required) + :type add_group_user_request: AddGroupUserRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_group_user_serialize( + group=group, + add_group_user_request=add_group_user_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddGroupUser200Response", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_group_user_serialize( + self, + group, + add_group_user_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if add_group_user_request is not None: + _body_params = add_group_user_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_group_details_with_http_info(group, **kwargs) # noqa: E501 - return data - - def get_group_details_with_http_info(self, group, **kwargs): # noqa: E501 - """Get group information # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_details_with_http_info(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :return: GroupDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['group'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_group_details" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'group' is set - if ('group' not in params or - params['group'] is None): - raise ValueError("Missing the required parameter `group` when calling `get_group_details`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'group' in params: - path_params['group'] = params['group'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/groups/{group}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='GroupDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_group_scores(self, group, **kwargs): # noqa: E501 - """List group's scores # noqa: E501 - - Get the list of scores shared with a group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_scores(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_group_scores_with_http_info(group, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/groups/{group}/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_group( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_group_with_http_info( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_group_without_preload_content( + self, + group_creation: GroupCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new group + + Create a group of the given type, tied to a classroom, optionally with initial members. + + :param group_creation: (required) + :type group_creation: GroupCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_group_serialize( + group_creation=group_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_group_serialize( + self, + group_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if group_creation is not None: + _body_params = group_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_group_scores_with_http_info(group, **kwargs) # noqa: E501 - return data - - def get_group_scores_with_http_info(self, group, **kwargs): # noqa: E501 - """List group's scores # noqa: E501 - - Get the list of scores shared with a group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_scores_with_http_info(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['group', 'parent'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_group_scores" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'group' is set - if ('group' not in params or - params['group'] is None): - raise ValueError("Missing the required parameter `group` when calling `get_group_scores`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'group' in params: - path_params['group'] = params['group'] # noqa: E501 - - query_params = [] - if 'parent' in params: - query_params.append(('parent', params['parent'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/groups/{group}/scores', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_group_users(self, group, **kwargs): # noqa: E501 - """List group's users # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_group_users(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :return: list[UserPublic] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_group_users_with_http_info(group, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/groups', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_group( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_group_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_group_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a group + + Delete a group. Only available to teachers of the classroom. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_group_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_group_serialize( + self, + group, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_group_details( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_group_details_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_group_details_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get group information + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_details_serialize( + group=group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_details_serialize( + self, + group, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_group_scores( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_group_scores_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_group_scores_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_scores_serialize( + self, + group, + parent, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_group_users( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserPublic]: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_group_users_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserPublic]]: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_group_users_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + source: Annotated[Optional[StrictStr], Field(description="Filter the users by their source ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's users + + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param source: Filter the users by their source + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_group_users_serialize( + group=group, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserPublic]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_group_users_serialize( + self, + group, + source, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if source is not None: + + _query_params.append(('source', source)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_groups( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[GroupDetails]: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_groups_with_http_info( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[GroupDetails]]: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_groups_without_preload_content( + self, + type: StrictStr, + classroom: Annotated[Optional[StrictStr], Field(description="Classroom ID to filter by")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Assignment ID to filter by")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List groups + + List all groups of a given type, filtered by either a classroom or an assignment. + + :param type: (required) + :type type: str + :param classroom: Classroom ID to filter by + :type classroom: str + :param assignment: Assignment ID to filter by + :type assignment: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + type=type, + classroom=classroom, + assignment=assignment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[GroupDetails]", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_groups_serialize( + self, + type, + classroom, + assignment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + if classroom is not None: + + _query_params.append(('classroom', classroom)) + + if assignment is not None: + + _query_params.append(('assignment', assignment)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def remove_group_user( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def remove_group_user_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def remove_group_user_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + user: Annotated[StrictStr, Field(description="User ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove a student from a class group + + Remove a student from a class group + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param user: User ID (required) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_group_user_serialize( + group=group, + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_group_user_serialize( + self, + group, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/groups/{group}/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def rename_group( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupDetails: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def rename_group_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupDetails]: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def rename_group_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + rename_group_request: RenameGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Rename a group + + Rename a sub-group. Only available for class student groups. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param rename_group_request: (required) + :type rename_group_request: RenameGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rename_group_serialize( + group=group, + rename_group_request=rename_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupDetails", + '400': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _rename_group_serialize( + self, + group, + rename_group_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rename_group_request is not None: + _body_params = rename_group_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_group_users_with_http_info(group, **kwargs) # noqa: E501 - return data - - def list_group_users_with_http_info(self, group, **kwargs): # noqa: E501 - """List group's users # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_group_users_with_http_info(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :return: list[UserPublic] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['group'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_group_users" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'group' is set - if ('group' not in params or - params['group'] is None): - raise ValueError("Missing the required parameter `group` when calling `list_group_users`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'group' in params: - path_params['group'] = params['group'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/groups/{group}/users', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[UserPublic]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/groups/{group}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/omr_api.py b/flat_api/api/omr_api.py new file mode 100644 index 0000000..aebf622 --- /dev/null +++ b/flat_api/api/omr_api.py @@ -0,0 +1,3646 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.models.credit_transaction import CreditTransaction +from flat_api.models.omr_capabilities import OmrCapabilities +from flat_api.models.omr_details_submission import OmrDetailsSubmission +from flat_api.models.omr_job import OmrJob +from flat_api.models.omr_job_creation import OmrJobCreation +from flat_api.models.omr_job_file_upload import OmrJobFileUpload +from flat_api.models.omr_job_file_upload_result import OmrJobFileUploadResult +from flat_api.models.omr_job_status import OmrJobStatus +from flat_api.models.omr_step_name import OmrStepName + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class OMRApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def add_omr_job_file( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_omr_job_file_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_omr_job_file_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + omr_job_file_upload: OmrJobFileUpload, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param omr_job_file_upload: (required) + :type omr_job_file_upload: OmrJobFileUpload + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_omr_job_file_serialize( + job=job, + omr_job_file_upload=omr_job_file_upload, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJobFileUploadResult", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_omr_job_file_serialize( + self, + job, + omr_job_file_upload, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if omr_job_file_upload is not None: + _body_params = omr_job_file_upload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/files', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def cancel_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OmrJob: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def cancel_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OmrJob]: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def cancel_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Cancel an OMR job + + Cancel a draft or in-flight job. Any charged credits are reversed. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._cancel_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _cancel_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/cancel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_omr_job( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_omr_job_with_http_info( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_omr_job_without_preload_content( + self, + omr_job_creation: OmrJobCreation, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. Pages are recognized in the orientation they are uploaded in. If your client does not let the user rotate pages before upload, set `autoRotate: true` and the server corrects pages uploaded sideways or upside down. + + :param omr_job_creation: (required) + :type omr_job_creation: OmrJobCreation + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_omr_job_serialize( + omr_job_creation=omr_job_creation, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "OmrJob", + '202': "OmrJob", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_omr_job_serialize( + self, + omr_job_creation, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if omr_job_creation is not None: + _body_params = omr_job_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 retention expiry: 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/omr/jobs/{job}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_omr_capabilities( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_omr_capabilities_with_http_info( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_omr_capabilities_without_preload_content( + self, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_capabilities_serialize( + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrCapabilities", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_capabilities_serialize( + self, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/capabilities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + wait: Annotated[Optional[Annotated[int, Field(le=25, strict=True, ge=0)]], Field(description="Long-poll up to this many seconds for a state change before returning.")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param wait: Long-poll up to this many seconds for a state change before returning. + :type wait: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_serialize( + job=job, + wait=wait, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OmrJob", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_serialize( + self, + job, + wait, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + if wait is not None: + + _query_params.append(('wait', wait)) + + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_omr_job_export( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_omr_job_export_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_omr_job_export_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + format: Annotated[StrictStr, Field(description="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: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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) + :type format: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_export_serialize( + job=job, + format=format, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_export_serialize( + self, + job, + format, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if format is not None: + _path_params['format'] = format + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/octet-stream', + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}/exports/{format}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_omr_job_file( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_omr_job_file_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_omr_job_file_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + index: Annotated[StrictInt, Field(description="0-based index of the input file (page) to fetch.")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param index: 0-based index of the input file (page) to fetch. (required) + :type index: int + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_omr_job_file_serialize( + job=job, + index=index, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '404': "FlatErrorResponse", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_omr_job_file_serialize( + self, + job, + index, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if index is not None: + _path_params['index'] = index + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'image/jpeg', + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs/{job}/files/{index}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_billing_credits_history( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_billing_credits_history_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_billing_credits_history_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`. + + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_billing_credits_history_serialize( + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CreditTransaction]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_billing_credits_history_serialize( + self, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/billing/credits/history', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_omr_jobs( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[OmrJob]: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_omr_jobs_with_http_info( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[OmrJob]]: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_omr_jobs_without_preload_content( + self, + status: Annotated[Optional[OmrJobStatus], Field(description="Filter jobs by status")] = None, + expired: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List OMR jobs + + List the caller's OMR jobs, for resuming work or cleaning up abandoned drafts. + + :param status: Filter jobs by status + :type status: OmrJobStatus + :param 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. + :type expired: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_omr_jobs_serialize( + status=status, + expired=expired, + limit=limit, + next=next, + previous=previous, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OmrJob]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_omr_jobs_serialize( + self, + status, + expired, + limit, + next, + previous, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if status is not None: + + _query_params.append(('status', status.value)) + + if expired is not None: + + _query_params.append(('expired', expired)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/omr/jobs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def start_omr_job( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OmrJob: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def start_omr_job_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OmrJob]: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def start_omr_job_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Start an OMR job + + Validate the attached files, run the permission, quota and credit checks, then queue the job for processing. + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_omr_job_serialize( + job=job, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _start_omr_job_serialize( + self, + job, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/start', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def submit_omr_job_step( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def submit_omr_job_step_with_http_info( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def submit_omr_job_step_without_preload_content( + self, + job: Annotated[StrictStr, Field(description="Unique identifier of the OMR job")], + step: Annotated[OmrStepName, Field(description="The pending step being submitted")], + body: OmrDetailsSubmission, + x_flat_locale: Annotated[Optional[StrictStr], Field(description="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`. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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). + + :param job: Unique identifier of the OMR job (required) + :type job: str + :param step: The pending step being submitted (required) + :type step: OmrStepName + :param body: (required) + :type body: OmrDetailsSubmission + :param 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`. + :type x_flat_locale: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_omr_job_step_serialize( + job=job, + step=step, + body=body, + x_flat_locale=x_flat_locale, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "OmrJob", + '409': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _submit_omr_job_step_serialize( + self, + job, + step, + body, + x_flat_locale, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job is not None: + _path_params['job'] = job + if step is not None: + _path_params['step'] = step.value + # process the query parameters + # process the header parameters + if x_flat_locale is not None: + _header_params['X-Flat-Locale'] = x_flat_locale + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/omr/jobs/{job}/steps/{step}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/organization_api.py b/flat_api/api/organization_api.py index 40b20a0..c18818b 100644 --- a/flat_api/api/organization_api.py +++ b/flat_api/api/organization_api.py @@ -1,1030 +1,4996 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from flat_api.api_client import ApiClient - + Generated by OpenAPI Generator (https://openapi-generator.tech) -class OrganizationApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.models.api_access_token import ApiAccessToken +from flat_api.models.lti_configuration import LtiConfiguration +from flat_api.models.lti_configuration_create import LtiConfigurationCreate +from flat_api.models.lti_configuration_update import LtiConfigurationUpdate +from flat_api.models.lti_credentials import LtiCredentials +from flat_api.models.lti_credentials_creation import LtiCredentialsCreation +from flat_api.models.organization_invitation import OrganizationInvitation +from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation +from flat_api.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation +from flat_api.models.user_admin_update import UserAdminUpdate +from flat_api.models.user_creation import UserCreation +from flat_api.models.user_details_admin import UserDetailsAdmin +from flat_api.models.user_signin_link import UserSigninLink +from flat_api.models.user_signin_link_creation import UserSigninLinkCreation + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class OrganizationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def create_lti_credentials(self, body, **kwargs): # noqa: E501 - """Create a new couple of LTI 1.x credentials # noqa: E501 - - 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/). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_lti_credentials(body, async=True) - >>> result = thread.get() - - :param async bool - :param LtiCredentialsCreation body: (required) - :return: LtiCredentials - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_lti_credentials_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_lti_credentials_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_lti_credentials_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a new couple of LTI 1.x credentials # noqa: E501 - - 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/). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_lti_credentials_with_http_info(body, async=True) - >>> result = thread.get() - - :param async bool - :param LtiCredentialsCreation body: (required) - :return: LtiCredentials - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_lti_credentials" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_lti_credentials`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/lti/credentials', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='LtiCredentials', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_organization_invitation(self, **kwargs): # noqa: E501 - """Create a new invitation to join the organization # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_organization_invitation(async=True) - >>> result = thread.get() - - :param async bool - :param OrganizationInvitationCreation body: - :return: OrganizationInvitation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_organization_invitation_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.create_organization_invitation_with_http_info(**kwargs) # noqa: E501 - return data - - def create_organization_invitation_with_http_info(self, **kwargs): # noqa: E501 - """Create a new invitation to join the organization # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_organization_invitation_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param OrganizationInvitationCreation body: - :return: OrganizationInvitation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization_invitation" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/invitations', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OrganizationInvitation', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_organization_user(self, **kwargs): # noqa: E501 - """Create a new user account # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_organization_user(async=True) - >>> result = thread.get() - - :param async bool - :param UserCreation body: - :return: UserDetailsAdmin - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_organization_user_with_http_info(**kwargs) # noqa: E501 + + @validate_call + def count_orga_users( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> int: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def count_orga_users_with_http_info( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[int]: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def count_orga_users_without_preload_content( + self, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Count the organization users using the provided filters + + + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._count_orga_users_serialize( + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "int", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _count_orga_users_serialize( + self, + role, + q, + group, + no_active_license, + test_accounts, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'role': 'multi', + 'group': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if role is not None: + + _query_params.append(('role', role)) + + if q is not None: + + _query_params.append(('q', q)) + + if group is not None: + + _query_params.append(('group', group)) + + if no_active_license is not None: + + _query_params.append(('noActiveLicense', no_active_license)) + + if test_accounts is not None: + + _query_params.append(('testAccounts', test_accounts)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/users/count', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_lti_configuration( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiConfiguration: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_lti_configuration_with_http_info( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiConfiguration]: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_lti_configuration_without_preload_content( + self, + lti_configuration_create: LtiConfigurationCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new LTI configuration (1.1 or 1.3) + + + :param lti_configuration_create: (required) + :type lti_configuration_create: LtiConfigurationCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_lti_configuration_serialize( + lti_configuration_create=lti_configuration_create, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_lti_configuration_serialize( + self, + lti_configuration_create, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if lti_configuration_create is not None: + _body_params = lti_configuration_create + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.create_organization_user_with_http_info(**kwargs) # noqa: E501 - return data - - def create_organization_user_with_http_info(self, **kwargs): # noqa: E501 - """Create a new user account # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_organization_user_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param UserCreation body: - :return: UserDetailsAdmin - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_organization_user" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/users', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='UserDetailsAdmin', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_lti_credentials(self, **kwargs): # noqa: E501 - """List LTI 1.x credentials # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_lti_credentials(async=True) - >>> result = thread.get() - - :param async bool - :return: list[LtiCredentials] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_lti_credentials_with_http_info(**kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/lti/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_lti_credentials( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiCredentials: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_lti_credentials_with_http_info( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiCredentials]: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_lti_credentials_without_preload_content( + self, + body: LtiCredentialsCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Create a new pair of LTI 1.1 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/). + + :param body: (required) + :type body: LtiCredentialsCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._create_lti_credentials_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiCredentials", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_lti_credentials_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_lti_credentials_with_http_info(**kwargs) # noqa: E501 - return data - - def list_lti_credentials_with_http_info(self, **kwargs): # noqa: E501 - """List LTI 1.x credentials # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_lti_credentials_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :return: list[LtiCredentials] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_lti_credentials" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/lti/credentials', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[LtiCredentials]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_organization_invitations(self, **kwargs): # noqa: E501 - """List the organization invitations # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_organization_invitations(async=True) - >>> result = thread.get() - - :param async bool - :param str role: Filter users by role - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[OrganizationInvitation] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_organization_invitations_with_http_info(**kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/lti/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_organization_invitation( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrganizationInvitation: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_invitation_with_http_info( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrganizationInvitation]: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_organization_invitation_without_preload_content( + self, + body: OrganizationInvitationCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new invitation to join the organization + + This method creates and sends an 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 unique identifier of the corresponding user. + + :param body: (required) + :type body: OrganizationInvitationCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_invitation_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrganizationInvitation", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_invitation_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_organization_invitations_with_http_info(**kwargs) # noqa: E501 - return data - - def list_organization_invitations_with_http_info(self, **kwargs): # noqa: E501 - """List the organization invitations # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_organization_invitations_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param str role: Filter users by role - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[OrganizationInvitation] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['role', 'limit', 'next', 'previous'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_organization_invitations" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - - if 'limit' in params and params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_organization_invitations`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in params and params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_organization_invitations`, must be a value greater than or equal to `1`") # noqa: E501 - collection_formats = {} - - path_params = {} - - query_params = [] - if 'role' in params: - query_params.append(('role', params['role'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'next' in params: - query_params.append(('next', params['next'])) # noqa: E501 - if 'previous' in params: - query_params.append(('previous', params['previous'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/invitations', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[OrganizationInvitation]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_organization_users(self, **kwargs): # noqa: E501 - """List the organization users # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_organization_users(async=True) - >>> result = thread.get() - - :param async bool - :param str role: Filter users by role - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[UserDetailsAdmin] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_organization_users_with_http_info(**kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_organization_user( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetailsAdmin: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_user_with_http_info( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetailsAdmin]: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_organization_user_without_preload_content( + self, + body: UserCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new user account + + + :param body: (required) + :type body: UserCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_organization_users_with_http_info(**kwargs) # noqa: E501 - return data - - def list_organization_users_with_http_info(self, **kwargs): # noqa: E501 - """List the organization users # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_organization_users_with_http_info(async=True) - >>> result = thread.get() - - :param async bool - :param str role: Filter users by role - :param int limit: This is the maximum number of objects that may be returned - :param str 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. - :param str 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. - :return: list[UserDetailsAdmin] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['role', 'limit', 'next', 'previous'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_organization_users" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - - if 'limit' in params and params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_organization_users`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in params and params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_organization_users`, must be a value greater than or equal to `1`") # noqa: E501 - collection_formats = {} - - path_params = {} - - query_params = [] - if 'role' in params: - query_params.append(('role', params['role'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'next' in params: - query_params.append(('next', params['next'])) # noqa: E501 - if 'previous' in params: - query_params.append(('previous', params['previous'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/users', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[UserDetailsAdmin]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def remove_organization_invitation(self, invitation, **kwargs): # noqa: E501 - """Remove an organization invitation # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_organization_invitation(invitation, async=True) - >>> result = thread.get() - - :param async bool - :param str invitation: Unique identifier of the invitation (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.remove_organization_invitation_with_http_info(invitation, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_organization_user_access_token( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_user_access_token_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_organization_user_access_token_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + organization_user_access_token_creation: OrganizationUserAccessTokenCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param organization_user_access_token_creation: (required) + :type organization_user_access_token_creation: OrganizationUserAccessTokenCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_access_token_serialize( + user=user, + organization_user_access_token_creation=organization_user_access_token_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApiAccessToken", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_access_token_serialize( + self, + user, + organization_user_access_token_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if organization_user_access_token_creation is not None: + _body_params = organization_user_access_token_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.remove_organization_invitation_with_http_info(invitation, **kwargs) # noqa: E501 - return data - - def remove_organization_invitation_with_http_info(self, invitation, **kwargs): # noqa: E501 - """Remove an organization invitation # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_organization_invitation_with_http_info(invitation, async=True) - >>> result = thread.get() - - :param async bool - :param str invitation: Unique identifier of the invitation (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['invitation'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method remove_organization_invitation" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'invitation' is set - if ('invitation' not in params or - params['invitation'] is None): - raise ValueError("Missing the required parameter `invitation` when calling `remove_organization_invitation`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'invitation' in params: - path_params['invitation'] = params['invitation'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/invitations/{invitation}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def remove_organization_user(self, user, **kwargs): # noqa: E501 - """Remove an account from Flat # noqa: E501 - - 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) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_organization_user(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of the Flat account (required) - :param bool 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.remove_organization_user_with_http_info(user, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users/{user}/accessToken', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_organization_user_signin_link( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserSigninLink: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_organization_user_signin_link_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserSigninLink]: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_organization_user_signin_link_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + user_signin_link_creation: UserSigninLinkCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a sign in link for an organization user + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param user_signin_link_creation: (required) + :type user_signin_link_creation: UserSigninLinkCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_organization_user_signin_link_serialize( + user=user, + user_signin_link_creation=user_signin_link_creation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSigninLink", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_organization_user_signin_link_serialize( + self, + user, + user_signin_link_creation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if user_signin_link_creation is not None: + _body_params = user_signin_link_creation + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.remove_organization_user_with_http_info(user, **kwargs) # noqa: E501 - return data - - def remove_organization_user_with_http_info(self, user, **kwargs): # noqa: E501 - """Remove an account from Flat # noqa: E501 - - 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) # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_organization_user_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of the Flat account (required) - :param bool 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'convert_to_individual'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method remove_organization_user" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `remove_organization_user`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - if 'convert_to_individual' in params: - query_params.append(('convertToIndividual', params['convert_to_individual'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/users/{user}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def revoke_lti_credentials(self, credentials, **kwargs): # noqa: E501 - """Revoke LTI 1.x credentials # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.revoke_lti_credentials(credentials, async=True) - >>> result = thread.get() - - :param async bool - :param str credentials: Credentials unique identifier (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.revoke_lti_credentials_with_http_info(credentials, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/organizations/users/{user}/signinLink', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_lti_configuration( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_lti_configuration_with_http_info( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_lti_configuration_without_preload_content( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete an LTI configuration + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_lti_configuration_serialize( + configuration=configuration, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_lti_configuration_serialize( + self, + configuration, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if configuration is not None: + _path_params['configuration'] = configuration + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/lti/configurations/{configuration}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_lti_configurations( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LtiConfiguration]: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_lti_configurations_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LtiConfiguration]]: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_lti_configurations_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List LTI configurations (1.1 and 1.3) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_lti_configurations_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiConfiguration]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_lti_configurations_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/lti/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_lti_credentials( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LtiCredentials]: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_lti_credentials_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LtiCredentials]]: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_lti_credentials_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) 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`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /organizations/lti/credentials is deprecated.", DeprecationWarning) + + _param = self._list_lti_credentials_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[LtiCredentials]", + '403': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_lti_credentials_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/lti/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_organization_invitations( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[OrganizationInvitation]: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_organization_invitations_with_http_info( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[OrganizationInvitation]]: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_organization_invitations_without_preload_content( + self, + role: Annotated[Optional[StrictStr], Field(description="Filter users by role")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the organization invitations + + + :param role: Filter users by role + :type role: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_invitations_serialize( + role=role, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[OrganizationInvitation]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_organization_invitations_serialize( + self, + role, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if role is not None: + + _query_params.append(('role', role)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/invitations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_organization_users( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserDetailsAdmin]: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_organization_users_with_http_info( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserDetailsAdmin]]: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_organization_users_without_preload_content( + self, + sort: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + role: Annotated[Optional[List[StrictStr]], Field(description="Filter users by role")] = None, + q: Annotated[Optional[StrictStr], Field(description="The query to search")] = None, + group: Annotated[Optional[List[StrictStr]], Field(description="Filter users by group")] = None, + no_active_license: Annotated[Optional[StrictBool], Field(description="Filter users who don't have an active license")] = None, + test_accounts: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + license_expiration_date: Annotated[Optional[List[StrictStr]], Field(description="Filter users by license expiration date or `active` / `notActive`")] = None, + only_ids: Annotated[Optional[StrictBool], Field(description="Return only user ids")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the organization users + + + :param 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. + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param role: Filter users by role + :type role: List[str] + :param q: The query to search + :type q: str + :param group: Filter users by group + :type group: List[str] + :param no_active_license: Filter users who don't have an active license + :type no_active_license: bool + :param 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. + :type test_accounts: str + :param license_expiration_date: Filter users by license expiration date or `active` / `notActive` + :type license_expiration_date: List[str] + :param only_ids: Return only user ids + :type only_ids: bool + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_organization_users_serialize( + sort=sort, + direction=direction, + next=next, + previous=previous, + role=role, + q=q, + group=group, + no_active_license=no_active_license, + test_accounts=test_accounts, + license_expiration_date=license_expiration_date, + only_ids=only_ids, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetailsAdmin]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_organization_users_serialize( + self, + sort, + direction, + next, + previous, + role, + q, + group, + no_active_license, + test_accounts, + license_expiration_date, + only_ids, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'role': 'multi', + 'group': 'multi', + 'licenseExpirationDate': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if role is not None: + + _query_params.append(('role', role)) + + if q is not None: + + _query_params.append(('q', q)) + + if group is not None: + + _query_params.append(('group', group)) + + if no_active_license is not None: + + _query_params.append(('noActiveLicense', no_active_license)) + + if test_accounts is not None: + + _query_params.append(('testAccounts', test_accounts)) + + if license_expiration_date is not None: + + _query_params.append(('licenseExpirationDate', license_expiration_date)) + + if only_ids is not None: + + _query_params.append(('onlyIds', only_ids)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/organizations/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def remove_organization_invitation( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def remove_organization_invitation_with_http_info( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def remove_organization_invitation_without_preload_content( + self, + invitation: Annotated[StrictStr, Field(description="Unique identifier of the invitation")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove an organization invitation + + + :param invitation: Unique identifier of the invitation (required) + :type invitation: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_invitation_serialize( + invitation=invitation, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_organization_invitation_serialize( + self, + invitation, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if invitation is not None: + _path_params['invitation'] = invitation + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/invitations/{invitation}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def remove_organization_user( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def remove_organization_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def remove_organization_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + convert_to_individual: Annotated[Optional[StrictBool], Field(description="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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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) + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param 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 performing this operation, you need to be sure that the user is at least 13 years old and has read and agreed to the Individual Terms of Service of Flat available on https://flat.io/legal. + :type convert_to_individual: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_organization_user_serialize( + user=user, + convert_to_individual=convert_to_individual, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_organization_user_serialize( + self, + user, + convert_to_individual, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if convert_to_individual is not None: + + _query_params.append(('convertToIndividual', convert_to_individual)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def revoke_lti_credentials( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def revoke_lti_credentials_with_http_info( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def revoke_lti_credentials_without_preload_content( + self, + credentials: Annotated[StrictStr, Field(description="Credentials unique identifier ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) 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`. + + :param credentials: Credentials unique identifier (required) + :type credentials: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("DELETE /organizations/lti/credentials/{credentials} is deprecated.", DeprecationWarning) + + _param = self._revoke_lti_credentials_serialize( + credentials=credentials, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _revoke_lti_credentials_serialize( + self, + credentials, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if credentials is not None: + _path_params['credentials'] = credentials + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/organizations/lti/credentials/{credentials}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_lti_configuration( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LtiConfiguration: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_lti_configuration_with_http_info( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LtiConfiguration]: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_lti_configuration_without_preload_content( + self, + configuration: Annotated[StrictStr, Field(description="Configuration unique identifier")], + lti_configuration_update: LtiConfigurationUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing LTI configuration (edit 1.3; 1.1 not editable) + + + :param configuration: Configuration unique identifier (required) + :type configuration: str + :param lti_configuration_update: (required) + :type lti_configuration_update: LtiConfigurationUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_lti_configuration_serialize( + configuration=configuration, + lti_configuration_update=lti_configuration_update, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LtiConfiguration", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_lti_configuration_serialize( + self, + configuration, + lti_configuration_update, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if configuration is not None: + _path_params['configuration'] = configuration + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if lti_configuration_update is not None: + _body_params = lti_configuration_update + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.revoke_lti_credentials_with_http_info(credentials, **kwargs) # noqa: E501 - return data - - def revoke_lti_credentials_with_http_info(self, credentials, **kwargs): # noqa: E501 - """Revoke LTI 1.x credentials # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.revoke_lti_credentials_with_http_info(credentials, async=True) - >>> result = thread.get() - - :param async bool - :param str credentials: Credentials unique identifier (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['credentials'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method revoke_lti_credentials" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'credentials' is set - if ('credentials' not in params or - params['credentials'] is None): - raise ValueError("Missing the required parameter `credentials` when calling `revoke_lti_credentials`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'credentials' in params: - path_params['credentials'] = params['credentials'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/lti/credentials/{credentials}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_organization_user(self, user, body, **kwargs): # noqa: E501 - """Update account information # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_organization_user(user, body, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of the Flat account (required) - :param UserAdminUpdate body: (required) - :return: UserDetailsAdmin - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_organization_user_with_http_info(user, body, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/organizations/lti/configurations/{configuration}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_organization_user( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserDetailsAdmin: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_organization_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserDetailsAdmin]: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_organization_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of the Flat account ")], + body: UserAdminUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update account information + + + :param user: Unique identifier of the Flat account (required) + :type user: str + :param body: (required) + :type body: UserAdminUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_organization_user_serialize( + user=user, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserDetailsAdmin", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_organization_user_serialize( + self, + user, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.update_organization_user_with_http_info(user, body, **kwargs) # noqa: E501 - return data - - def update_organization_user_with_http_info(self, user, body, **kwargs): # noqa: E501 - """Update account information # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_organization_user_with_http_info(user, body, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of the Flat account (required) - :param UserAdminUpdate body: (required) - :return: UserDetailsAdmin - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_organization_user" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `update_organization_user`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_organization_user`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/organizations/users/{user}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='UserDetailsAdmin', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/organizations/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/score_api.py b/flat_api/api/score_api.py index e684ef3..142d407 100644 --- a/flat_api/api/score_api.py +++ b/flat_api/api/score_api.py @@ -1,3135 +1,9310 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six + Generated by OpenAPI Generator (https://openapi-generator.tech) -from flat_api.api_client import ApiClient - - -class ScoreApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictStr, field_validator +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation +from flat_api.models.score_comment import ScoreComment +from flat_api.models.score_comment_creation import ScoreCommentCreation +from flat_api.models.score_comment_update import ScoreCommentUpdate +from flat_api.models.score_creation import ScoreCreation +from flat_api.models.score_details import ScoreDetails +from flat_api.models.score_fork import ScoreFork +from flat_api.models.score_modification import ScoreModification +from flat_api.models.score_revision import ScoreRevision +from flat_api.models.score_revision_creation import ScoreRevisionCreation +from flat_api.models.score_track import ScoreTrack +from flat_api.models.score_track_creation import ScoreTrackCreation +from flat_api.models.score_track_creation_response import ScoreTrackCreationResponse +from flat_api.models.score_track_update import ScoreTrackUpdate +from flat_api.models.task import Task +from flat_api.models.task_export_options import TaskExportOptions + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class ScoreApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def add_score_collaborator(self, score, body, **kwargs): # noqa: E501 - """Add a new collaborator # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_collaborator(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ResourceCollaboratorCreation body: (required) - :return: ResourceCollaborator - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.add_score_collaborator_with_http_info(score, body, **kwargs) # noqa: E501 - else: - (data) = self.add_score_collaborator_with_http_info(score, body, **kwargs) # noqa: E501 - return data - - def add_score_collaborator_with_http_info(self, score, body, **kwargs): # noqa: E501 - """Add a new collaborator # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_collaborator_with_http_info(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ResourceCollaboratorCreation body: (required) - :return: ResourceCollaborator - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_score_collaborator" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `add_score_collaborator`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `add_score_collaborator`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/collaborators', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ResourceCollaborator', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def add_score_track(self, score, body, **kwargs): # noqa: E501 - """Add a new video or audio track to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_track(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreTrackCreation body: (required) - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.add_score_track_with_http_info(score, body, **kwargs) # noqa: E501 - else: - (data) = self.add_score_track_with_http_info(score, body, **kwargs) # noqa: E501 - return data - - def add_score_track_with_http_info(self, score, body, **kwargs): # noqa: E501 - """Add a new video or audio track to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.add_score_track_with_http_info(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreTrackCreation body: (required) - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_score_track" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `add_score_track`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `add_score_track`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/tracks', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreTrack', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_score(self, body, **kwargs): # noqa: E501 - """Create a new score # noqa: E501 - - Use this API method to **create a new music score in the current User account**. You will need a MusicXML 3 (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`) or a MIDI (`audio/midi`) file to create the new Flat document. 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. This can be the `root` collection or a different collection based on the user's settings or API authentication method. 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}`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_score(body, async=True) - >>> result = thread.get() - - :param async bool - :param ScoreCreation body: (required) - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_score_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_score_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_score_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a new score # noqa: E501 - - Use this API method to **create a new music score in the current User account**. You will need a MusicXML 3 (`vnd.recordare.musicxml` or `vnd.recordare.musicxml+xml`) or a MIDI (`audio/midi`) file to create the new Flat document. 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. This can be the `root` collection or a different collection based on the user's settings or API authentication method. 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}`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_score_with_http_info(body, async=True) - >>> result = thread.get() - - :param async bool - :param ScoreCreation body: (required) - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_score" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_score_revision(self, score, body, **kwargs): # noqa: E501 - """Create a new revision # noqa: E501 - - Update a score by uploading a new revision for this one. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_score_revision(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreRevisionCreation body: (required) - :return: ScoreRevision - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.create_score_revision_with_http_info(score, body, **kwargs) # noqa: E501 - else: - (data) = self.create_score_revision_with_http_info(score, body, **kwargs) # noqa: E501 - return data - - def create_score_revision_with_http_info(self, score, body, **kwargs): # noqa: E501 - """Create a new revision # noqa: E501 - - Update a score by uploading a new revision for this one. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.create_score_revision_with_http_info(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreRevisionCreation body: (required) - :return: ScoreRevision - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_score_revision" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `create_score_revision`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_score_revision`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/revisions', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreRevision', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_score(self, score, **kwargs): # noqa: E501 - """Delete a score # noqa: E501 - - This method can be used by the owner/admin (`aclAdmin` rights) of a score as well as regular collaborators. 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 regular collaborator (`aclRead` / `aclWrite`), the score will be unshared (i.e. removed from the account & own collections). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_score_with_http_info(score, **kwargs) # noqa: E501 - else: - (data) = self.delete_score_with_http_info(score, **kwargs) # noqa: E501 - return data - - def delete_score_with_http_info(self, score, **kwargs): # noqa: E501 - """Delete a score # noqa: E501 - - This method can be used by the owner/admin (`aclAdmin` rights) of a score as well as regular collaborators. 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 regular collaborator (`aclRead` / `aclWrite`), the score will be unshared (i.e. removed from the account & own collections). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_score" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `delete_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_score_comment(self, score, comment, **kwargs): # noqa: E501 - """Delete a comment # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_comment(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_score_comment_with_http_info(score, comment, **kwargs) # noqa: E501 - else: - (data) = self.delete_score_comment_with_http_info(score, comment, **kwargs) # noqa: E501 - return data - - def delete_score_comment_with_http_info(self, score, comment, **kwargs): # noqa: E501 - """Delete a comment # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_comment_with_http_info(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'comment', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_score_comment" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `delete_score_comment`") # noqa: E501 - # verify the required parameter 'comment' is set - if ('comment' not in params or - params['comment'] is None): - raise ValueError("Missing the required parameter `comment` when calling `delete_score_comment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'comment' in params: - path_params['comment'] = params['comment'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments/{comment}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_score_track(self, score, track, **kwargs): # noqa: E501 - """Remove an audio or video track linked to the score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_track(score, track, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.delete_score_track_with_http_info(score, track, **kwargs) # noqa: E501 - else: - (data) = self.delete_score_track_with_http_info(score, track, **kwargs) # noqa: E501 - return data - - def delete_score_track_with_http_info(self, score, track, **kwargs): # noqa: E501 - """Remove an audio or video track linked to the score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.delete_score_track_with_http_info(score, track, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'track'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_score_track" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `delete_score_track`") # noqa: E501 - # verify the required parameter 'track' is set - if ('track' not in params or - params['track'] is None): - raise ValueError("Missing the required parameter `track` when calling `delete_score_track`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'track' in params: - path_params['track'] = params['track'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/tracks/{track}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def edit_score(self, score, **kwargs): # noqa: E501 - """Edit a score's metadata # noqa: E501 - - 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` of the score, the API metadata are updated directly when calling this method, unlike the data itself. The title in the score data will be \"lazy\" updated at the next score save with the editor or our internal save. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_score(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreModification body: - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.edit_score_with_http_info(score, **kwargs) # noqa: E501 - else: - (data) = self.edit_score_with_http_info(score, **kwargs) # noqa: E501 - return data - - def edit_score_with_http_info(self, score, **kwargs): # noqa: E501 - """Edit a score's metadata # noqa: E501 - - 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` of the score, the API metadata are updated directly when calling this method, unlike the data itself. The title in the score data will be \"lazy\" updated at the next score save with the editor or our internal save. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.edit_score_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreModification body: - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method edit_score" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `edit_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def fork_score(self, score, body, **kwargs): # noqa: E501 - """Fork a score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.fork_score(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreFork body: (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.fork_score_with_http_info(score, body, **kwargs) # noqa: E501 - else: - (data) = self.fork_score_with_http_info(score, body, **kwargs) # noqa: E501 - return data - - def fork_score_with_http_info(self, score, body, **kwargs): # noqa: E501 - """Fork a score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.fork_score_with_http_info(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreFork body: (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method fork_score" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `fork_score`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `fork_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/fork', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def ger_user_likes(self, user, **kwargs): # noqa: E501 - """List liked scores # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.ger_user_likes(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.ger_user_likes_with_http_info(user, **kwargs) # noqa: E501 - else: - (data) = self.ger_user_likes_with_http_info(user, **kwargs) # noqa: E501 - return data - - def ger_user_likes_with_http_info(self, user, **kwargs): # noqa: E501 - """List liked scores # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.ger_user_likes_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'ids'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method ger_user_likes" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `ger_user_likes`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - if 'ids' in params: - query_params.append(('ids', params['ids'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/users/{user}/likes', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_group_scores(self, group, **kwargs): # noqa: E501 - """List group's scores # noqa: E501 - - Get the list of scores shared with a group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_scores(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_group_scores_with_http_info(group, **kwargs) # noqa: E501 - else: - (data) = self.get_group_scores_with_http_info(group, **kwargs) # noqa: E501 - return data - - def get_group_scores_with_http_info(self, group, **kwargs): # noqa: E501 - """List group's scores # noqa: E501 - - Get the list of scores shared with a group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_group_scores_with_http_info(group, async=True) - >>> result = thread.get() - - :param async bool - :param str group: Unique identifier of a Flat group (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['group', 'parent'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_group_scores" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'group' is set - if ('group' not in params or - params['group'] is None): - raise ValueError("Missing the required parameter `group` when calling `get_group_scores`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'group' in params: - path_params['group'] = params['group'] # noqa: E501 - - query_params = [] - if 'parent' in params: - query_params.append(('parent', params['parent'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/groups/{group}/scores', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score(self, score, **kwargs): # noqa: E501 - """Get a score's metadata # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_with_http_info(score, **kwargs) # noqa: E501 - else: - (data) = self.get_score_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_with_http_info(self, score, **kwargs): # noqa: E501 - """Get a score's metadata # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: ScoreDetails - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreDetails', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_collaborator(self, score, collaborator, **kwargs): # noqa: E501 - """Get a collaborator # noqa: E501 - - Get the information about a collaborator (User or Group). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_collaborator(score, collaborator, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - :param str 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. - :return: ResourceCollaborator - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_collaborator_with_http_info(score, collaborator, **kwargs) # noqa: E501 - else: - (data) = self.get_score_collaborator_with_http_info(score, collaborator, **kwargs) # noqa: E501 - return data - - def get_score_collaborator_with_http_info(self, score, collaborator, **kwargs): # noqa: E501 - """Get a collaborator # noqa: E501 - - Get the information about a collaborator (User or Group). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_collaborator_with_http_info(score, collaborator, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - :param str 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. - :return: ResourceCollaborator - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'collaborator', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_collaborator" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_collaborator`") # noqa: E501 - # verify the required parameter 'collaborator' is set - if ('collaborator' not in params or - params['collaborator'] is None): - raise ValueError("Missing the required parameter `collaborator` when calling `get_score_collaborator`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'collaborator' in params: - path_params['collaborator'] = params['collaborator'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/collaborators/{collaborator}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ResourceCollaborator', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_collaborators(self, score, **kwargs): # noqa: E501 - """List the collaborators # noqa: E501 - - 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). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_collaborators(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ResourceCollaborator] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_collaborators_with_http_info(score, **kwargs) # noqa: E501 - else: - (data) = self.get_score_collaborators_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_collaborators_with_http_info(self, score, **kwargs): # noqa: E501 - """List the collaborators # noqa: E501 - - 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). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_collaborators_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ResourceCollaborator] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_collaborators" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_collaborators`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/collaborators', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ResourceCollaborator]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_comments(self, score, **kwargs): # noqa: E501 - """List comments # noqa: E501 - - This method lists the different comments added on a music score (documents and inline) sorted by their post dates. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_comments(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :param str type: Filter the comments by type - :param str sort: Sort - :param str direction: Sort direction - :return: list[ScoreComment] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_comments_with_http_info(score, **kwargs) # noqa: E501 - else: - (data) = self.get_score_comments_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_comments_with_http_info(self, score, **kwargs): # noqa: E501 - """List comments # noqa: E501 - - This method lists the different comments added on a music score (documents and inline) sorted by their post dates. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_comments_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :param str type: Filter the comments by type - :param str sort: Sort - :param str direction: Sort direction - :return: list[ScoreComment] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'sharing_key', 'type', 'sort', 'direction'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_comments" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_comments`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - if 'type' in params: - query_params.append(('type', params['type'])) # noqa: E501 - if 'sort' in params: - query_params.append(('sort', params['sort'])) # noqa: E501 - if 'direction' in params: - query_params.append(('direction', params['direction'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreComment]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_revision(self, score, revision, **kwargs): # noqa: E501 - """Get a score revision # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revision(score, revision, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - :param str 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. - :return: ScoreRevision - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_revision_with_http_info(score, revision, **kwargs) # noqa: E501 - else: - (data) = self.get_score_revision_with_http_info(score, revision, **kwargs) # noqa: E501 - return data - - def get_score_revision_with_http_info(self, score, revision, **kwargs): # noqa: E501 - """Get a score revision # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revision_with_http_info(score, revision, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - :param str 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. - :return: ScoreRevision - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'revision', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_revision" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_revision`") # noqa: E501 - # verify the required parameter 'revision' is set - if ('revision' not in params or - params['revision'] is None): - raise ValueError("Missing the required parameter `revision` when calling `get_score_revision`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'revision' in params: - path_params['revision'] = params['revision'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/revisions/{revision}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreRevision', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_revision_data(self, score, revision, format, **kwargs): # noqa: E501 - """Get a score revision data # noqa: E501 - - Retrieve the file corresponding to a score revision (the following formats are available: Flat JSON/Adagio JSON `json`, MusicXML `mxl`/`xml`, MP3 `mp3`, WAV `wav`, MIDI `midi`, or a tumbnail of the first page `thumbnail.png`). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revision_data(score, revision, format, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - :param str format: The format of the file you will retrieve (required) - :param str 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. - :param str 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\". - :param bool only_cached: Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned - :return: str - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_revision_data_with_http_info(score, revision, format, **kwargs) # noqa: E501 - else: - (data) = self.get_score_revision_data_with_http_info(score, revision, format, **kwargs) # noqa: E501 - return data - - def get_score_revision_data_with_http_info(self, score, revision, format, **kwargs): # noqa: E501 - """Get a score revision data # noqa: E501 - - Retrieve the file corresponding to a score revision (the following formats are available: Flat JSON/Adagio JSON `json`, MusicXML `mxl`/`xml`, MP3 `mp3`, WAV `wav`, MIDI `midi`, or a tumbnail of the first page `thumbnail.png`). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revision_data_with_http_info(score, revision, format, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) - :param str format: The format of the file you will retrieve (required) - :param str 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. - :param str 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\". - :param bool only_cached: Only return files already generated and cached in Flat's production cache. If the file is not availabe, a 404 will be returned - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'revision', 'format', 'sharing_key', 'parts', 'only_cached'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_revision_data" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_revision_data`") # noqa: E501 - # verify the required parameter 'revision' is set - if ('revision' not in params or - params['revision'] is None): - raise ValueError("Missing the required parameter `revision` when calling `get_score_revision_data`") # noqa: E501 - # verify the required parameter 'format' is set - if ('format' not in params or - params['format'] is None): - raise ValueError("Missing the required parameter `format` when calling `get_score_revision_data`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'revision' in params: - path_params['revision'] = params['revision'] # noqa: E501 - if 'format' in params: - path_params['format'] = params['format'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - if 'parts' in params: - query_params.append(('parts', params['parts'])) # noqa: E501 - if 'only_cached' in params: - query_params.append(('onlyCached', params['only_cached'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json', 'application/vnd.recordare.musicxml+xml', 'application/vnd.recordare.musicxml', 'audio/mp3', 'audio/wav', 'audio/midi', 'image/png']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/revisions/{revision}/{format}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_revisions(self, score, **kwargs): # noqa: E501 - """List the revisions # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revisions(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ScoreRevision] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_revisions_with_http_info(score, **kwargs) # noqa: E501 + + @validate_call + def add_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ResourceCollaborator: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ResourceCollaborator]: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ResourceCollaboratorCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a new collaborator + + Share a score with a single user or a group. This API call allows you to add, invite and update the collaborators of a resource. - To add an existing Flat user to the resource, specify their unique identifier in the `user` property. - To invite an external user to the resource, specify their 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ResourceCollaboratorCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_collaborator_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_collaborator_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_score_revisions_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_revisions_with_http_info(self, score, **kwargs): # noqa: E501 - """List the revisions # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_revisions_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ScoreRevision] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_revisions" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_revisions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/revisions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreRevision]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_submissions(self, score, **kwargs): # noqa: E501 - """List submissions related to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_submissions(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_submissions_with_http_info(score, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/collaborators', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def add_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrackCreationResponse: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrackCreationResponse]: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreTrackCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a new video or audio track to the score + + Use this method to add a new track to the score. This track can then be played on flat.io or in an embedded score. This API method supports media hosted on SoundCloud, YouTube and Vimeo. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreTrackCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_score_track_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrackCreationResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_score_track_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_score_submissions_with_http_info(score, **kwargs) # noqa: E501 - return data - - def get_score_submissions_with_http_info(self, score, **kwargs): # noqa: E501 - """List submissions related to the score # noqa: E501 - - 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. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_submissions_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: list[AssignmentSubmission] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_submissions" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_submissions`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/submissions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[AssignmentSubmission]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_score_track(self, score, track, **kwargs): # noqa: E501 - """Retrieve the details of an audio or video track linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_track(score, track, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :param str 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. - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_score_track_with_http_info(score, track, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/tracks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_export_task( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Task: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_export_task_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Task]: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_export_task_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file that will be generated or the target service name where the file will be exported")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + body: Optional[TaskExportOptions] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new score export task + + Some score exports take longer to process than a single API request allows. Use this endpoint to launch a new export of one score hosted on Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file that will be generated or the target service name where the file will be exported (required) + :type format: str + :param 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. + :type sharing_key: str + :param body: + :type body: TaskExportOptions + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_task_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_export_task_serialize( + self, + score, + revision, + format, + sharing_key, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + if format is not None: + _path_params['format'] = format + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_score_track_with_http_info(score, track, **kwargs) # noqa: E501 - return data - - def get_score_track_with_http_info(self, score, track, **kwargs): # noqa: E501 - """Retrieve the details of an audio or video track linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_score_track_with_http_info(score, track, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :param str 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. - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'track', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_score_track" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `get_score_track`") # noqa: E501 - # verify the required parameter 'track' is set - if ('track' not in params or - params['track'] is None): - raise ValueError("Missing the required parameter `track` when calling `get_score_track`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'track' in params: - path_params['track'] = params['track'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/tracks/{track}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreTrack', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_user_scores(self, user, **kwargs): # noqa: E501 - """List user's scores # noqa: E501 - - Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user_scores(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_user_scores_with_http_info(user, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/revisions/{revision}/{format}/task', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_score( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreDetails: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_score_with_http_info( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreDetails]: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_score_without_preload_content( + self, + body: ScoreCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new score + + Use this API method to **create a new music score in the current User account**. This endpoint 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 then be modified using our web application or by uploading a new revision of this file (`POST /v2/scores/{score}/revisions`). The currently authenticated user will be the 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}`. + + :param body: (required) + :type body: ScoreCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '202': "Task", + '400': "FlatErrorResponse", + '402': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_score_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.get_user_scores_with_http_info(user, **kwargs) # noqa: E501 - return data - - def get_user_scores_with_http_info(self, user, **kwargs): # noqa: E501 - """List user's scores # noqa: E501 - - Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user_scores_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'parent'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_scores" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `get_user_scores`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - if 'parent' in params: - query_params.append(('parent', params['parent'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/users/{user}/scores', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_score_tracks(self, score, **kwargs): # noqa: E501 - """List the audio or video tracks linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_score_tracks(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ScoreTrack] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.list_score_tracks_with_http_info(score, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_score_revision( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreRevision: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_score_revision_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreRevision]: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_score_revision_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreRevisionCreation, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new revision + + Update a score by uploading a new revision for this one. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreRevisionCreation + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_score_revision_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_score_revision_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.list_score_tracks_with_http_info(score, **kwargs) # noqa: E501 - return data - - def list_score_tracks_with_http_info(self, score, **kwargs): # noqa: E501 - """List the audio or video tracks linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.list_score_tracks_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str 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. - :return: list[ScoreTrack] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_score_tracks" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `list_score_tracks`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/tracks', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreTrack]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def mark_score_comment_resolved(self, score, comment, **kwargs): # noqa: E501 - """Mark the comment as resolved # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.mark_score_comment_resolved(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.mark_score_comment_resolved_with_http_info(score, comment, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/revisions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictBool], Field(description="If `true`, the score deletion will be scheduled as soon as possible")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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's collections. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param now: If `true`, the score deletion will be scheduled as soon as possible + :type now: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_serialize( + score=score, + now=now, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_serialize( + self, + score, + now, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if now is not None: + + _query_params.append(('now', now)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_comment_serialize( + score=score, + comment=comment, + event_properties=event_properties, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_comment_serialize( + self, + score, + comment, + event_properties, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.mark_score_comment_resolved_with_http_info(score, comment, **kwargs) # noqa: E501 - return data - - def mark_score_comment_resolved_with_http_info(self, score, comment, **kwargs): # noqa: E501 - """Mark the comment as resolved # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.mark_score_comment_resolved_with_http_info(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'comment', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method mark_score_comment_resolved" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `mark_score_comment_resolved`") # noqa: E501 - # verify the required parameter 'comment' is set - if ('comment' not in params or - params['comment'] is None): - raise ValueError("Missing the required parameter `comment` when calling `mark_score_comment_resolved`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'comment' in params: - path_params['comment'] = params['comment'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments/{comment}/resolved', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def mark_score_comment_unresolved(self, score, comment, **kwargs): # noqa: E501 - """Mark the comment as unresolved # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.mark_score_comment_unresolved(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.mark_score_comment_unresolved_with_http_info(score, comment, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove an audio or video track linked to the score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_score_track_serialize( + score=score, + track=track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_score_track_serialize( + self, + score, + track, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def edit_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def edit_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def edit_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreModification, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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`). When editing the `title`, `subtitle`, `composer`, `lyricist`, `arranger` or `licenseText`, the metadata is updated immediately, and a real-time action is pushed to update the document lazily. This pending document modification is automatically saved as a new revision, either by a connected client or by Flat. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreModification + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edit_score_serialize( + score=score, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _edit_score_serialize( + self, + score, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.mark_score_comment_unresolved_with_http_info(score, comment, **kwargs) # noqa: E501 - return data - - def mark_score_comment_unresolved_with_http_info(self, score, comment, **kwargs): # noqa: E501 - """Mark the comment as unresolved # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.mark_score_comment_unresolved_with_http_info(score, comment, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param str 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. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'comment', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method mark_score_comment_unresolved" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `mark_score_comment_unresolved`") # noqa: E501 - # verify the required parameter 'comment' is set - if ('comment' not in params or - params['comment'] is None): - raise ValueError("Missing the required parameter `comment` when calling `mark_score_comment_unresolved`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'comment' in params: - path_params['comment'] = params['comment'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments/{comment}/resolved', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def post_score_comment(self, score, body, **kwargs): # noqa: E501 - """Post a new comment # noqa: E501 - - 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`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.post_score_comment(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreCommentCreation body: (required) - :param str 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. - :return: ScoreComment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.post_score_comment_with_http_info(score, body, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def fork_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def fork_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def fork_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreFork, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreFork + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fork_score_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fork_score_serialize( + self, + score, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.post_score_comment_with_http_info(score, body, **kwargs) # noqa: E501 - return data - - def post_score_comment_with_http_info(self, score, body, **kwargs): # noqa: E501 - """Post a new comment # noqa: E501 - - 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`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.post_score_comment_with_http_info(score, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param ScoreCommentCreation body: (required) - :param str 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. - :return: ScoreComment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'body', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method post_score_comment" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `post_score_comment`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `post_score_comment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreComment', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def remove_score_collaborator(self, score, collaborator, **kwargs): # noqa: E501 - """Delete a collaborator # noqa: E501 - - Remove the specified collaborator from the score # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_score_collaborator(score, collaborator, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.remove_score_collaborator_with_http_info(score, collaborator, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/fork', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_group_scores( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_group_scores_with_http_info( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_group_scores_without_preload_content( + self, + group: Annotated[StrictStr, Field(description="Unique identifier of a Flat group ")], + parent: Annotated[Optional[StrictStr], Field(description="Only return the scores forked from the score `parent`")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List group's scores + + Get the list of scores shared with a group. + + :param group: Unique identifier of a Flat group (required) + :type group: str + :param parent: Only return the scores forked from the score `parent` + :type parent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_scores_serialize( + group=group, + parent=parent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_group_scores_serialize( + self, + group, + parent, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group is not None: + _path_params['group'] = group + # process the query parameters + if parent is not None: + + _query_params.append(('parent', parent)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/groups/{group}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreDetails", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ResourceCollaborator: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ResourceCollaborator]: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a collaborator + + Get the information about a collaborator (User or Group). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborator_serialize( + score=score, + collaborator=collaborator, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResourceCollaborator", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_collaborator_serialize( + self, + score, + collaborator, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if collaborator is not None: + _path_params['collaborator'] = collaborator + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/collaborators/{collaborator}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_collaborators( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_collaborators_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_collaborators_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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). + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_collaborators_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ResourceCollaborator]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_collaborators_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/collaborators', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_comments( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreComment]: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_comments_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreComment]]: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_comments_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="Filter the comments by type")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List comments + + This method lists the different comments added on a music score (documents and inline) sorted by their post dates. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param type: Filter the comments by type + :type type: str + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_comments_serialize( + score=score, + type=type, + sort=sort, + direction=direction, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreComment]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_comments_serialize( + self, + score, + type, + sort, + direction, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_revision( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_revision_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_revision_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_serialize( + score=score, + revision=revision, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreRevision", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revision_serialize( + self, + score, + revision, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions/{revision}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_revision_data( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytes: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_revision_data_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytes]: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_revision_data_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. ")], + format: Annotated[StrictStr, Field(description="The format of the file you will retrieve")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + parts: Annotated[Optional[StrictStr], Field(description="An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". ")] = None, + default_track: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + url: Annotated[Optional[StrictBool], Field(description="Returns a json with the `url` in it instead of redirecting ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a score revision data + + Retrieve the file corresponding to a score revision (the following formats are available): Flat JSON `json`, MusicXML `mxl`/`xml`, ABC notation `abc`, MP3 `mp3`, WAV `wav`, MIDI `midi`, Flat `flat`, a thumbnail 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 that ABC has no equivalent for is approximated or dropped rather than failing the request. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param revision: Unique identifier of a score revision. You can use `last` to fetch the information related to the last version created. (required) + :type revision: str + :param format: The format of the file you will retrieve (required) + :type format: str + :param 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. + :type sharing_key: str + :param parts: An optional set of part UUIDs to export. This parameter must be composed of part UUIDs separated by commas. For example \"59df645f-bb1c-f1b4-b573-d2afc4491f94,34ef645f-1aef-f3bc-1564-34cca4492b87\". + :type parts: str + :param 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. + :type default_track: bool + :param url: Returns a json with the `url` in it instead of redirecting + :type url: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revision_data_serialize( + score=score, + revision=revision, + format=format, + sharing_key=sharing_key, + parts=parts, + default_track=default_track, + url=url, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytes", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revision_data_serialize( + self, + score, + revision, + format, + sharing_key, + parts, + default_track, + url, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if revision is not None: + _path_params['revision'] = revision + if format is not None: + _path_params['format'] = format + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + if parts is not None: + + _query_params.append(('parts', parts)) + + if default_track is not None: + + _query_params.append(('defaultTrack', default_track)) + + if url is not None: + + _query_params.append(('url', url)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + 'application/vnd.recordare.musicxml+xml', + 'application/vnd.recordare.musicxml', + 'audio/mp3', + 'audio/wav', + 'audio/midi', + 'image/png', + 'application/octet-stream' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions/{revision}/{format}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_revisions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_revisions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_revisions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 on the plan of the account, this list may be truncated to the most recent revisions. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_revisions_serialize( + score=score, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreRevision]", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_revisions_serialize( + self, + score, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/revisions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_submissions( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_submissions_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_submissions_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 who is part of the organization and has at least read access to the document. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_submissions_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[AssignmentSubmission]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_submissions_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/submissions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrack: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrack]: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the details of an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_score_track_serialize( + score=score, + track=track, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_score_track_serialize( + self, + score, + track, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_user_likes( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_likes_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_likes_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_likes_serialize( + self, + user, + next, + previous, + limit, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/likes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_user_scores( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_scores_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_scores_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_scores_serialize( + self, + user, + paginate, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if paginate is not None: + + _query_params.append(('paginate', paginate)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_score_tracks( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_score_tracks_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_score_tracks_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + assignment: Annotated[Optional[StrictStr], Field(description="Only return the tracks related to this assignment ")] = None, + list_auto_track: Annotated[Optional[StrictBool], Field(description="If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param 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. + :type sharing_key: str + :param assignment: Only return the tracks related to this assignment + :type assignment: str + :param list_auto_track: If `true`, and when available, also return the latest MP3 export automatically generated by Flat as an additional track + :type list_auto_track: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_score_tracks_serialize( + score=score, + sharing_key=sharing_key, + assignment=assignment, + list_auto_track=list_auto_track, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreTrack]", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_score_tracks_serialize( + self, + score, + sharing_key, + assignment, + list_auto_track, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + if assignment is not None: + + _query_params.append(('assignment', assignment)) + + if list_auto_track is not None: + + _query_params.append(('listAutoTrack', list_auto_track)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/scores/{score}/tracks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def mark_score_comment_resolved( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def mark_score_comment_resolved_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def mark_score_comment_resolved_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Mark the comment as resolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_resolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _mark_score_comment_resolved_serialize( + self, + score, + comment, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/comments/{comment}/resolved', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def mark_score_comment_unresolved( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def mark_score_comment_unresolved_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def mark_score_comment_unresolved_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Mark the comment as unresolved + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._mark_score_comment_unresolved_serialize( + score=score, + comment=comment, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _mark_score_comment_unresolved_serialize( + self, + score, + comment, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/comments/{comment}/resolved', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def post_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> 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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def post_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def post_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: ScoreCommentCreation, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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 users. Comments can be blocked by returning a `403` HTTP error and hidden from other users when the `spam` property is `true`. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param body: (required) + :type body: ScoreCommentCreation + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_score_comment_serialize( + score=score, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_score_comment_serialize( + self, + score, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.remove_score_collaborator_with_http_info(score, collaborator, **kwargs) # noqa: E501 - return data - - def remove_score_collaborator_with_http_info(self, score, collaborator, **kwargs): # noqa: E501 - """Delete a collaborator # noqa: E501 - - Remove the specified collaborator from the score # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.remove_score_collaborator_with_http_info(score, collaborator, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'collaborator'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method remove_score_collaborator" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `remove_score_collaborator`") # noqa: E501 - # verify the required parameter 'collaborator' is set - if ('collaborator' not in params or - params['collaborator'] is None): - raise ValueError("Missing the required parameter `collaborator` when calling `remove_score_collaborator`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'collaborator' in params: - path_params['collaborator'] = params['collaborator'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/collaborators/{collaborator}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def untrash_score(self, score, **kwargs): # noqa: E501 - """Untrash a score # noqa: E501 - - This method will remove the score from the `trash` collection and from the deletion queue, and add it back to the original collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.untrash_score(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.untrash_score_with_http_info(score, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/comments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def remove_score_collaborator( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def remove_score_collaborator_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def remove_score_collaborator_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** ")], + event_properties: Annotated[Optional[StrictStr], Field(description="Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a collaborator + + Remove the specified collaborator from the score + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param collaborator: Unique identifier of a **collaborator permission**, or unique identifier of a **User**, or unique identifier of a **Group** (required) + :type collaborator: str + :param event_properties: Optional analytics properties merged into the analytics events recorded for this request. JSON-encoded string representing event properties. Example: - `?eventProperties={\"context\":\"discover\",\"screenLevel0\":\"home\"}` + :type event_properties: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._remove_score_collaborator_serialize( + score=score, + collaborator=collaborator, + event_properties=event_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _remove_score_collaborator_serialize( + self, + score, + collaborator, + event_properties, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if collaborator is not None: + _path_params['collaborator'] = collaborator + # process the query parameters + if event_properties is not None: + + _query_params.append(('eventProperties', event_properties)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.untrash_score_with_http_info(score, **kwargs) # noqa: E501 - return data - - def untrash_score_with_http_info(self, score, **kwargs): # noqa: E501 - """Untrash a score # noqa: E501 - - This method will remove the score from the `trash` collection and from the deletion queue, and add it back to the original collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.untrash_score_with_http_info(score, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method untrash_score" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `untrash_score`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/untrash', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_score_comment(self, score, comment, body, **kwargs): # noqa: E501 - """Update an existing comment # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_score_comment(score, comment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param ScoreCommentUpdate body: (required) - :param str 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. - :return: ScoreComment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_score_comment_with_http_info(score, comment, body, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/scores/{score}/collaborators/{collaborator}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def untrash_score( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def untrash_score_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def untrash_score_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """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. + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._untrash_score_serialize( + score=score, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _untrash_score_serialize( + self, + score, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/scores/{score}/untrash', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_score_comment( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreComment: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_score_comment_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreComment]: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_score_comment_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a sheet music comment ")], + body: ScoreCommentUpdate, + sharing_key: Annotated[Optional[StrictStr], Field(description="This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing comment + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param comment: Unique identifier of a sheet music comment (required) + :type comment: str + :param body: (required) + :type body: ScoreCommentUpdate + :param 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. + :type sharing_key: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_comment_serialize( + score=score, + comment=comment, + body=body, + sharing_key=sharing_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreComment", + '402': "FlatErrorResponse", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_score_comment_serialize( + self, + score, + comment, + body, + sharing_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if comment is not None: + _path_params['comment'] = comment + # process the query parameters + if sharing_key is not None: + + _query_params.append(('sharingKey', sharing_key)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.update_score_comment_with_http_info(score, comment, body, **kwargs) # noqa: E501 - return data - - def update_score_comment_with_http_info(self, score, comment, body, **kwargs): # noqa: E501 - """Update an existing comment # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_score_comment_with_http_info(score, comment, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str comment: Unique identifier of a sheet music comment (required) - :param ScoreCommentUpdate body: (required) - :param str 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. - :return: ScoreComment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'comment', 'body', 'sharing_key'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_score_comment" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `update_score_comment`") # noqa: E501 - # verify the required parameter 'comment' is set - if ('comment' not in params or - params['comment'] is None): - raise ValueError("Missing the required parameter `comment` when calling `update_score_comment`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_score_comment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'comment' in params: - path_params['comment'] = params['comment'] # noqa: E501 - - query_params = [] - if 'sharing_key' in params: - query_params.append(('sharingKey', params['sharing_key'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/comments/{comment}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreComment', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_score_track(self, score, track, body, **kwargs): # noqa: E501 - """Update an audio or video track linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_score_track(score, track, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :param ScoreTrackUpdate body: (required) - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.update_score_track_with_http_info(score, track, body, **kwargs) # noqa: E501 + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/comments/{comment}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_score_track( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ScoreTrack: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_score_track_with_http_info( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ScoreTrack]: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_score_track_without_preload_content( + self, + score: Annotated[StrictStr, Field(description="Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `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: Annotated[StrictStr, Field(description="Unique identifier of a score audio track ")], + body: ScoreTrackUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an audio or video track linked to a score + + + :param score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) + :type score: str + :param track: Unique identifier of a score audio track (required) + :type track: str + :param body: (required) + :type body: ScoreTrackUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_score_track_serialize( + score=score, + track=track, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ScoreTrack", + '403': "FlatErrorResponse", + '404': "FlatErrorResponse", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_score_track_serialize( + self, + score, + track, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if score is not None: + _path_params['score'] = score + if track is not None: + _path_params['track'] = track + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type else: - (data) = self.update_score_track_with_http_info(score, track, body, **kwargs) # noqa: E501 - return data - - def update_score_track_with_http_info(self, score, track, body, **kwargs): # noqa: E501 - """Update an audio or video track linked to a score # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.update_score_track_with_http_info(score, track, body, async=True) - >>> result = thread.get() - - :param async bool - :param str score: Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). (required) - :param str track: Unique identifier of a score audio track (required) - :param ScoreTrackUpdate body: (required) - :return: ScoreTrack - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['score', 'track', 'body'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_score_track" % key + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'score' is set - if ('score' not in params or - params['score'] is None): - raise ValueError("Missing the required parameter `score` when calling `update_score_track`") # noqa: E501 - # verify the required parameter 'track' is set - if ('track' not in params or - params['track'] is None): - raise ValueError("Missing the required parameter `track` when calling `update_score_track`") # noqa: E501 - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_score_track`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'score' in params: - path_params['score'] = params['score'] # noqa: E501 - if 'track' in params: - path_params['track'] = params['track'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/scores/{score}/tracks/{track}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ScoreTrack', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/scores/{score}/tracks/{track}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/task_api.py b/flat_api/api/task_api.py new file mode 100644 index 0000000..1f77a8a --- /dev/null +++ b/flat_api/api/task_api.py @@ -0,0 +1,302 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from flat_api.models.task import Task + +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType + + +class TaskApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_task( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Task: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_task_with_http_info( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Task]: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_task_without_preload_content( + self, + task: Annotated[StrictStr, Field(description="Unique identifier for the task")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get task details + + This method can be used to follow the progress of a task, for example while a score is being exported. + + :param task: Unique identifier for the task (required) + :type task: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_task_serialize( + task=task, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Task", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_task_serialize( + self, + task, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if task is not None: + _path_params['task'] = task + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/tasks/{task}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api/user_api.py b/flat_api/api/user_api.py index 9f919c3..a6ba391 100644 --- a/flat_api/api/user_api.py +++ b/flat_api/api/user_api.py @@ -1,337 +1,999 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import -import re # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -# python 2 and python 3 compatibility library -import six +from pydantic import Field, StrictBool, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated +from flat_api.models.score_details import ScoreDetails +from flat_api.models.user_public import UserPublic -from flat_api.api_client import ApiClient +from flat_api.api_client import ApiClient, RequestSerialized +from flat_api.api_response import ApiResponse +from flat_api.rest import RESTResponseType -class UserApi(object): - """NOTE: This class is auto generated by the swagger code generator program. +class UserApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - def ger_user_likes(self, user, **kwargs): # noqa: E501 - """List liked scores # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.ger_user_likes(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.ger_user_likes_with_http_info(user, **kwargs) # noqa: E501 - else: - (data) = self.ger_user_likes_with_http_info(user, **kwargs) # noqa: E501 - return data - - def ger_user_likes_with_http_info(self, user, **kwargs): # noqa: E501 - """List liked scores # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.ger_user_likes_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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 - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'ids'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method ger_user_likes" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `ger_user_likes`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - if 'ids' in params: - query_params.append(('ids', params['ids'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/users/{user}/likes', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_user(self, user, **kwargs): # noqa: E501 - """Get a public user profile # noqa: E501 - - Get a public profile of a Flat User. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: UserPublic - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_user_with_http_info(user, **kwargs) # noqa: E501 - else: - (data) = self.get_user_with_http_info(user, **kwargs) # noqa: E501 - return data - - def get_user_with_http_info(self, user, **kwargs): # noqa: E501 - """Get a public user profile # noqa: E501 - - Get a public profile of a Flat User. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str 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) - :return: UserPublic - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `get_user`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/users/{user}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='UserPublic', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_user_scores(self, user, **kwargs): # noqa: E501 - """List user's scores # noqa: E501 - - Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user_scores(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async'): - return self.get_user_scores_with_http_info(user, **kwargs) # noqa: E501 - else: - (data) = self.get_user_scores_with_http_info(user, **kwargs) # noqa: E501 - return data - - def get_user_scores_with_http_info(self, user, **kwargs): # noqa: E501 - """List user's scores # noqa: E501 - - Get the list of public scores owned by a User. **DEPRECATED**: Please note that the current behavior will be deprecrated on **2019-01-01**. This method will no longer list private and shared scores, but only public scores of a Flat account. If you want to access to private scores, please use the [Collections API](#tag/Collection) instead. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async=True - >>> thread = api.get_user_scores_with_http_info(user, async=True) - >>> result = thread.get() - - :param async bool - :param str user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) - :param str parent: Filter the score forked from the score id `parent` - :return: list[ScoreDetails] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['user', 'parent'] # noqa: E501 - all_params.append('async') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_scores" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'user' is set - if ('user' not in params or - params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `get_user_scores`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'user' in params: - path_params['user'] = params['user'] # noqa: E501 - - query_params = [] - if 'parent' in params: - query_params.append(('parent', params['parent'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['OAuth2'] # noqa: E501 - - return self.api_client.call_api( - '/users/{user}/scores', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[ScoreDetails]', # noqa: E501 - auth_settings=auth_settings, - async=params.get('async'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + + @validate_call + def get_user( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserPublic: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_with_http_info( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserPublic]: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="This route parameter is the unique identifier of the user. You can specify an email instead of a 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. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a public user profile + + Get a profile of a Flat or Flat for Education User. + + :param user: This route parameter is the unique identifier of the user. You can specify an email instead of a 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) + :type user: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + user=user, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserPublic", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_serialize( + self, + user, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_user_likes( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_likes_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_likes_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + ids: Annotated[Optional[StrictBool], Field(description="Return only the identifiers of the scores")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List liked scores + + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type next: str + :param 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. + :type previous: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param ids: Return only the identifiers of the scores + :type ids: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_likes_serialize( + user=user, + next=next, + previous=previous, + limit=limit, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_likes_serialize( + self, + user, + next, + previous, + limit, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/likes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_user_scores( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ScoreDetails]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_scores_with_http_info( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ScoreDetails]]: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_scores_without_preload_content( + self, + user: Annotated[StrictStr, Field(description="Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. ")], + paginate: Annotated[Optional[StrictBool], Field(description="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. ")] = None, + sort: Annotated[Optional[StrictStr], Field(description="Sort")] = None, + direction: Annotated[Optional[StrictStr], Field(description="Sort direction")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="This is the maximum number of objects that may be returned")] = None, + next: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + previous: Annotated[Optional[StrictStr], Field(description="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. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List user's scores + + Get the list of public scores owned by a User. If you want to access private scores, please use the [Collections API](#tag/Collection). For example `GET /v2/collections/allScores/scores` to list all recently updated scores. + + :param user: Unique identifier of a Flat user. If you authenticated, you can use `me` to refer to the current user. (required) + :type user: str + :param 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. + :type paginate: bool + :param sort: Sort + :type sort: str + :param direction: Sort direction + :type direction: str + :param limit: This is the maximum number of objects that may be returned + :type limit: int + :param 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. + :type next: str + :param 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. + :type previous: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_scores_serialize( + user=user, + paginate=paginate, + sort=sort, + direction=direction, + limit=limit, + next=next, + previous=previous, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ScoreDetails]", + 'default': "FlatErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_scores_serialize( + self, + user, + paginate, + sort, + direction, + limit, + next, + previous, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user is not None: + _path_params['user'] = user + # process the query parameters + if paginate is not None: + + _query_params.append(('paginate', paginate)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if direction is not None: + + _query_params.append(('direction', direction)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if next is not None: + + _query_params.append(('next', next)) + + if previous is not None: + + _query_params.append(('previous', previous)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/users/{user}/scores', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/flat_api/api_client.py b/flat_api/api_client.py index abdc2ca..576e780 100644 --- a/flat_api/api_client.py +++ b/flat_api/api_client.py @@ -1,45 +1,57 @@ -# coding: utf-8 """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + -from __future__ import absolute_import import datetime +from dateutil.parser import parse +from enum import Enum +import decimal import json import mimetypes -from multiprocessing.pool import ThreadPool import os import re import tempfile +import uuid -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import quote +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr +from flat_api.errors import from_response as _flat_error_from_response from flat_api.configuration import Configuration +from flat_api.api_response import ApiResponse, T as ApiResponseT import flat_api.models from flat_api import rest - - -class ApiClient(object): - """Generic API client for Swagger client library builds. - - Swagger generic API client. This client handles the client- +from flat_api.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the Swagger + the methods and models for each application are generated from the OpenAPI templates. - NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. - :param configuration: .Configuration object for this client :param header_name: a header to pass when making calls to the API. :param header_value: a header value to pass when making calls to @@ -48,36 +60,47 @@ class ApiClient(object): to the API """ - PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + PRIMITIVE_TYPES = (float, bool, bytes, str, int) NATIVE_TYPES_MAPPING = { 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 + 'long': int, # TODO remove as only py3 is supported? 'float': float, 'str': str, 'bool': bool, 'date': datetime.date, 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, 'object': object, } - - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided if configuration is None: - configuration = Configuration() + configuration = Configuration.get_default() self.configuration = configuration - self.pool = ThreadPool() self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/0.6.0/python' + self.user_agent = _flat_user_agent() + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self - def __del__(self): - self.pool.close() - self.pool.join() + def __exit__(self, exc_type, exc_value, traceback): + pass @property def user_agent(self): @@ -91,12 +114,69 @@ def user_agent(self, value): def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ config = self.configuration @@ -107,14 +187,17 @@ def __call_api( header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( @@ -122,113 +205,228 @@ def __call_api( quote(str(v), safe=config.safe_chars_for_path_param) ) - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) - # post parameters if post_params or files: - post_params = self.prepare_post_parameters(post_params, files) + post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) # body if body: body = self.sanitize_for_serialization(body) # request url - url = self.configuration.host + resource_path - - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - - self.last_response = response_data - - return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - - if _return_http_data_only: - return (return_data) + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path else: - return (return_data, response_data.status, - response_data.getheaders()) + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise _flat_error_from_response( + status=response_data.status, + body=return_data if isinstance(return_data, dict) else response_text, + headers=dict(response_data.getheaders() or {}), + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. - If obj is swagger model, return the properties dict. + If obj is OpenAPI model, return the properties dict. :param obj: The data to serialize. :return: The serialized form of data. """ if obj is None: return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - - if isinstance(obj, dict): - obj_dict = obj + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `swagger_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None} - - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} - - def deserialize(self, response, response_type): + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. :param response_type: class literal for deserialized object, or string of class name. + :param content_type: content type of response. :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) # fetch data from response object - try: - data = json.loads(response.data) - except ValueError: - data = response.data + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) return self.__deserialize(data, response_type) @@ -243,16 +441,20 @@ def __deserialize(self, data, klass): if data is None: return None - if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match('list\[(.*)\]', klass).group(1) + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - if klass.startswith('dict('): - sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} + for k, v in data.items()} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -262,136 +464,21 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datatime(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async request, set the async parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param async bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: - If async parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async is False or missing, - then the method will return the response directly. - """ - if not async: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout) - else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, _request_timeout)) - return thread - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -399,10 +486,10 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -422,49 +509,94 @@ def parameters_to_tuples(self, params, collection_formats): new_params.append((k, v)) return new_params - def prepare_post_parameters(self, post_params=None, files=None): + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, quote(str(value))) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. - :param post_params: Normal form parameters. :param files: File parameters. :return: Form parameters with files. """ params = [] - - if post_params: - params = post_params - - if files: - for k, v in six.iteritems(files): - if not v: - continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) - + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None - accepts = [x.lower() for x in accepts] + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept - if 'application/json' in accepts: - return 'application/json' - else: - return ', '.join(accepts) + return accepts[0] def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -473,45 +605,110 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return 'application/json' - - content_types = [x.lower() for x in content_types] - - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' - else: - return content_types[0] + return None - def update_params_for_auth(self, headers, querys, auth_settings): + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. - :param querys: Query parameters tuple list to be updated. + :param queries: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - if not auth_setting['value']: - continue - elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ValueError( - 'Authentication token must be in `query` or `header`' + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting ) + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters + cookie_value = str(auth_setting['value']) + if not re.match("^\".*\"$", cookie_value): + cookie_value = cookie_value.replace("\"", "\\\"") + cookie_value = f"\"{cookie_value}\"" + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + def __deserialize_file(self, response): """Deserializes body to file Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. + handle file downloading + save response body into a tmp file and return the instance + :param response: RESTResponse. :return: file path. """ @@ -519,10 +716,16 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -541,12 +744,12 @@ def __deserialize_primitive(self, data, klass): try: return klass(data) except UnicodeEncodeError: - return six.text_type(data) + return str(data) except TypeError: return data def __deserialize_object(self, value): - """Return a original value. + """Return an original value. :return: object. """ @@ -559,7 +762,6 @@ def __deserialize_date(self, string): :return: date. """ try: - from dateutil.parser import parse return parse(string).date() except ImportError: return string @@ -569,7 +771,7 @@ def __deserialize_date(self, string): reason="Failed to parse `{0}` as date object".format(string) ) - def __deserialize_datatime(self, string): + def __deserialize_datetime(self, string): """Deserializes string to datetime. The string should be in iso8601 datetime format. @@ -578,7 +780,6 @@ def __deserialize_datatime(self, string): :return: datetime. """ try: - from dateutil.parser import parse return parse(string) except ImportError: return string @@ -591,6 +792,24 @@ def __deserialize_datatime(self, string): ) ) + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + def __deserialize_model(self, data, klass): """Deserializes list or dict to model. @@ -599,23 +818,18 @@ def __deserialize_model(self, data, klass): :return: model object. """ - if not klass.swagger_types and not hasattr(klass, - 'get_real_child_model'): - return data + return klass.from_dict(data) + + +def _flat_user_agent() -> str: + """`Flat-SDK-Python/ (python/)`. + + Derived from the package version so it can never drift from what is published. + """ + import platform + + from flat_api import __version__ - kwargs = {} - if klass.swagger_types is not None: - for attr, attr_type in six.iteritems(klass.swagger_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): - value = data[klass.attribute_map[attr]] - kwargs[attr] = self.__deserialize(value, attr_type) - - instance = klass(**kwargs) - - if hasattr(instance, 'get_real_child_model'): - klass_name = instance.get_real_child_model(data) - if klass_name: - instance = self.__deserialize(data, klass_name) - return instance + return ( + f"Flat-SDK-Python/{__version__} (python/{platform.python_version()})" + ) diff --git a/flat_api/api_response.py b/flat_api/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/flat_api/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/flat_api/client.py b/flat_api/client.py new file mode 100644 index 0000000..bd793ae --- /dev/null +++ b/flat_api/client.py @@ -0,0 +1,78 @@ +"""The entry points a developer actually uses. + +``FlatClient`` is synchronous, ``AsyncFlatClient`` is its asynchronous twin. Both take the same +arguments and raise the same typed errors; only the call convention differs. +""" + +from __future__ import annotations + +from typing import Any + +from flat_api.api_client import ApiClient +from flat_api.configuration import Configuration +from flat_api.oauth import OAuth2Helper, TokenManager, Tokens +from flat_api._retry import RetryPolicy + +__all__ = ["FlatClient", "AsyncFlatClient"] + +DEFAULT_BASE_URL = "https://api.flat.io/v2" +#: A finite default. Waiting forever is not an acceptable default for an SDK. +DEFAULT_TIMEOUT = 30.0 + + +class _BaseClient: + def __init__( + self, + access_token: str | None = None, + *, + tokens: Tokens | None = None, + oauth: OAuth2Helper | None = None, + on_token_refresh: Any = None, + base_url: str = DEFAULT_BASE_URL, + timeout: float = DEFAULT_TIMEOUT, + retry: RetryPolicy | None = None, + ) -> None: + if access_token is None and tokens is None: + raise ValueError("pass either access_token= or tokens=") + if tokens is None: + tokens = Tokens(access_token=access_token or "") + + self.tokens = TokenManager(tokens, helper=oauth, on_token_refresh=on_token_refresh) + self.retry = retry if retry is not None else RetryPolicy() + self.base_url = base_url + self.timeout = timeout + + configuration = Configuration(host=base_url) + configuration.access_token = self.tokens.access_token + self._configuration = configuration + self._api_client = self._build_api_client(configuration) + + def _build_api_client(self, configuration: Configuration) -> Any: + return ApiClient(configuration) + + @property + def api_client(self) -> Any: + """The generated client, for operations not yet surfaced ergonomically.""" + return self._api_client + + def _reauthenticate(self) -> None: + """Refresh the access token and push it into the generated configuration.""" + token = self.tokens.refresh() + self._configuration.access_token = token + + +class FlatClient(_BaseClient): + """Synchronous Flat API client. + + client = FlatClient(access_token="...") + me = client.api_client # generated APIs hang off here + """ + + +class AsyncFlatClient(_BaseClient): + """Asynchronous Flat API client, backed by the ``flat_api.aio`` generation pass.""" + + def _build_api_client(self, configuration: Configuration) -> Any: + from flat_api.aio.api_client import ApiClient as AsyncApiClient + + return AsyncApiClient(configuration) diff --git a/flat_api/configuration.py b/flat_api/configuration.py index 778ec8e..a725988 100644 --- a/flat_api/configuration.py +++ b/flat_api/configuration.py @@ -1,111 +1,413 @@ -# coding: utf-8 - """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import copy +import http.client as httplib import logging +from logging import FileHandler import multiprocessing import sys -import urllib3 - -import six -from six.moves import http_client as httplib - - -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - - def __call__(cls): - if cls._default is None: - cls._default = type.__call__(cls) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from urllib.parse import urlparse +from urllib.request import getproxies +from typing_extensions import NotRequired, Self +import urllib3 -class Configuration(six.with_metaclass(TypeWithDefault, object)): - """NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "OAuth2": OAuth2AuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int | urllib3.util.retry.Retry - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param no_proxy: Comma-separated hosts that bypass the proxy. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + :Example: """ - def __init__(self): - """Constructor""" - # Default Base url - self.host = "https://api.flat.io/v2" - # Temp file folder for downloading files + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[Union[int, urllib3.util.retry.Retry]] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + no_proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "https://api.flat.io/v2" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ self.temp_folder_path = None - + """Temp file folder for downloading files + """ # Authentication Settings - # dict to store API key(s) self.api_key = {} - # dict to store API prefix (e.g. Bearer) + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ self.api_key_prefix = {} - # Username for HTTP basic authentication - self.username = "" - # Password for HTTP basic authentication - self.password = "" - - # access token for OAuth - self.access_token = "" - - # Logging Settings + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ self.logger = {} + """Logging Settings + """ self.logger["package_logger"] = logging.getLogger("flat_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' - # Log stream handler + """Log format + """ self.logger_stream_handler = None - # Log file handler - self.logger_file_handler = None - # Debug file location + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ self.logger_file = None - # Debug switch - self.debug = False - - # SSL/TLS verification - # Set this to false to skip verifying SSL certificate when calling API - # from https server. - self.verify_ssl = True - # Set this to customize the certificate file to verify the peer. - self.ssl_ca_cert = None - # client certificate file - self.cert_file = None - # client key file - self.key_file = None - # Set this to True/False to enable/disable SSL hostname verification. - self.assert_hostname = None - - # urllib3 connection pool's maximum number of connections saved - # per pool. urllib3 uses 1 connection as default value, but this is - # not the best value when you are making a lot of possibly parallel - # requests to the same host, which is often the case here. - # cpu_count * 5 is used as default value to increase performance. - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - - # Proxy URL - self.proxy = None - # Safe chars for path_param - self.safe_chars_for_path_param = '' + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. None in the constructor is coerced to cpu_count * 5. + """ + + # urllib3 does not read proxy environment variables itself: + # https://github.com/urllib3/urllib3/issues/1785 + if proxy is None or no_proxy is None: + proxies = getproxies() + if proxy is None: + scheme = urlparse(self.host).scheme + proxy = proxies.get(scheme) or proxies.get("all") + if no_proxy is None: + no_proxy = proxies.get("no") + self.proxy = proxy + """Proxy URL + """ + self.no_proxy = no_proxy + """Hosts that bypass the proxy + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -117,7 +419,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -132,22 +434,11 @@ def logger_file(self, value): # then add file handler and remove stream handler. self.logger_file_handler = logging.FileHandler(self.__logger_file) self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -156,7 +447,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -165,20 +456,20 @@ def debug(self, value): self.__debug = value if self.__debug: # if debug status is True, turn on debug logging - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.setLevel(logging.DEBUG) # turn on httplib debug httplib.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.setLevel(logging.WARNING) # turn off httplib debug httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -189,7 +480,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -200,45 +491,58 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. :return: The token for api key authentication. """ - if (self.api_key.get(identifier) and - self.api_key_prefix.get(identifier)): - return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 - elif self.api_key.get(identifier): - return self.api_key[identifier] - - def get_basic_auth_token(self): + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password + basic_auth=username + ':' + password ).get('authorization') - def auth_settings(self): + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - return { - - 'OAuth2': - { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - }, - - } - - def to_debug_report(self): + auth: AuthSettings = {} + if self.access_token is not None: + auth['OAuth2'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -246,6 +550,74 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 2.6.0\n"\ - "SDK Package Version: 0.6.0".\ + "Version of the API: 2.26.2\n"\ + "SDK Package Version: 2.0.0".\ format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.flat.io/v2", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/flat_api/errors.py b/flat_api/errors.py new file mode 100644 index 0000000..11fc5ca --- /dev/null +++ b/flat_api/errors.py @@ -0,0 +1,137 @@ +"""Typed errors for the Flat API. + +Branch on the error class, not on the status code: rate limiting and authorization failures both +return HTTP 403 and are separated only by the response body's ``code``. +""" + +from __future__ import annotations + +from typing import Any, Mapping + +__all__ = [ + "FlatError", + "FlatAuthenticationError", + "FlatAuthorizationError", + "FlatRateLimitError", + "FlatValidationError", + "FlatNotFoundError", + "FlatQuotaError", + "FlatServerError", + "from_response", +] + +RATE_LIMIT_CODE = "API_RATE_LIMIT_EXCEEDED" +QUOTA_CODES = frozenset({"QUOTA_EXCEEDED", "CREDITS_EXHAUSTED", "OMR_CREDITS_EXHAUSTED"}) + + +class FlatError(Exception): + """Base class for every error raised by this SDK.""" + + def __init__( + self, + message: str, + *, + status: int | None = None, + code: str | None = None, + request_id: str | None = None, + headers: Mapping[str, str] | None = None, + body: Any = None, + ) -> None: + super().__init__(message) + self.message = message + self.status = status + self.code = code + #: The server-provided error identifier. Present only for internal and backend errors, + #: so treat it as optional and quote it to support when you have it. + self.request_id = request_id + self.headers = dict(headers or {}) + self.body = body + + def __str__(self) -> str: + parts = [self.message] + if self.code: + parts.append(f"code={self.code}") + if self.status is not None: + parts.append(f"status={self.status}") + if self.request_id: + parts.append(f"id={self.request_id}") + return " ".join(parts) + + +class FlatAuthenticationError(FlatError): + """The token is missing, invalid or expired, or a refresh failed. Re-authorize.""" + + +class FlatAuthorizationError(FlatError): + """Authenticated but not permitted: a missing scope or insufficient permission.""" + + +class FlatRateLimitError(FlatError): + """The account or IP exceeded its request quota. Returned as HTTP 403, not 429.""" + + def __init__(self, message: str, **kwargs: Any) -> None: + super().__init__(message, **kwargs) + self.limit = _int_header(self.headers, "X-RateLimit-Limit") + self.remaining = _int_header(self.headers, "X-RateLimit-Remaining") + #: UTC epoch seconds at which the window resets. Flat sends no Retry-After header. + self.reset = _int_header(self.headers, "X-RateLimit-Reset") + + +class FlatValidationError(FlatError): + """The request body or parameters failed validation.""" + + +class FlatNotFoundError(FlatError): + """The resource does not exist, or is not visible to this token.""" + + +class FlatQuotaError(FlatError): + """A metered resource, such as OMR credits, is exhausted.""" + + +class FlatServerError(FlatError): + """An internal or backend error. ``request_id`` is normally set here.""" + + +def _int_header(headers: Mapping[str, str], name: str) -> int | None: + for key, value in headers.items(): + if key.lower() == name.lower(): + try: + return int(value) + except (TypeError, ValueError): + return None + return None + + +def from_response( + status: int, + body: Any, + headers: Mapping[str, str] | None = None, +) -> FlatError: + """Build the right error for a non-2xx response.""" + payload = body if isinstance(body, dict) else {} + code = payload.get("code") + message = payload.get("message") or f"HTTP {status}" + common = { + "status": status, + "code": code, + "request_id": payload.get("id"), + "headers": headers, + "body": body, + } + + if status == 403 and code == RATE_LIMIT_CODE: + return FlatRateLimitError(message, **common) + if code in QUOTA_CODES: + return FlatQuotaError(message, **common) + if status == 401: + return FlatAuthenticationError(message, **common) + if status == 403: + return FlatAuthorizationError(message, **common) + if status == 404: + return FlatNotFoundError(message, **common) + if status in (400, 422): + return FlatValidationError(message, **common) + if status >= 500: + return FlatServerError(message, **common) + return FlatError(message, **common) diff --git a/flat_api/exceptions.py b/flat_api/exceptions.py new file mode 100644 index 0000000..cc06420 --- /dev/null +++ b/flat_api/exceptions.py @@ -0,0 +1,219 @@ +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/flat_api/models/__init__.py b/flat_api/models/__init__.py index 4d62706..bb64626 100644 --- a/flat_api/models/__init__.py +++ b/flat_api/models/__init__.py @@ -4,22 +4,49 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import absolute_import + Do not edit the class manually. +""" # noqa: E501 # import models into model package +from flat_api.models.add_group_user200_response import AddGroupUser200Response +from flat_api.models.add_group_user_request import AddGroupUserRequest +from flat_api.models.api_access_token import ApiAccessToken +from flat_api.models.app_scopes import AppScopes from flat_api.models.assignment import Assignment +from flat_api.models.assignment_capabilities import AssignmentCapabilities +from flat_api.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError from flat_api.models.assignment_copy import AssignmentCopy -from flat_api.models.assignment_creation import AssignmentCreation +from flat_api.models.assignment_copy_response import AssignmentCopyResponse +from flat_api.models.assignment_copy_to_class import AssignmentCopyToClass +from flat_api.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary +from flat_api.models.assignment_group import AssignmentGroup from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.assignment_submission_comment import AssignmentSubmissionComment +from flat_api.models.assignment_submission_comment_creation import AssignmentSubmissionCommentCreation +from flat_api.models.assignment_submission_comments import AssignmentSubmissionComments +from flat_api.models.assignment_submission_history import AssignmentSubmissionHistory +from flat_api.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment +from flat_api.models.assignment_submission_history_state import AssignmentSubmissionHistoryState +from flat_api.models.assignment_submission_lti import AssignmentSubmissionLti +from flat_api.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.models.assignment_submission_state import AssignmentSubmissionState +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.assignment_update import AssignmentUpdate +from flat_api.models.class_assignment import ClassAssignment +from flat_api.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas +from flat_api.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti +from flat_api.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc +from flat_api.models.class_assignment_update import ClassAssignmentUpdate +from flat_api.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph from flat_api.models.class_attachment_creation import ClassAttachmentCreation from flat_api.models.class_creation import ClassCreation from flat_api.models.class_details import ClassDetails @@ -27,50 +54,129 @@ from flat_api.models.class_details_clever import ClassDetailsClever from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive +from flat_api.models.class_details_issues import ClassDetailsIssues +from flat_api.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner from flat_api.models.class_details_lti import ClassDetailsLti +from flat_api.models.class_details_mfc import ClassDetailsMfc +from flat_api.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph +from flat_api.models.class_grade_level import ClassGradeLevel from flat_api.models.class_roles import ClassRoles from flat_api.models.class_state import ClassState from flat_api.models.class_update import ClassUpdate from flat_api.models.collection import Collection +from flat_api.models.collection_app import CollectionApp from flat_api.models.collection_capabilities import CollectionCapabilities +from flat_api.models.collection_contents import CollectionContents from flat_api.models.collection_creation import CollectionCreation from flat_api.models.collection_modification import CollectionModification from flat_api.models.collection_privacy import CollectionPrivacy -from flat_api.models.collection_title import CollectionTitle from flat_api.models.collection_type import CollectionType +from flat_api.models.credit_transaction import CreditTransaction +from flat_api.models.edu_library import EduLibrary +from flat_api.models.edu_resource import EduResource +from flat_api.models.edu_resource_assignment_creation import EduResourceAssignmentCreation +from flat_api.models.edu_resource_capabilities import EduResourceCapabilities +from flat_api.models.edu_resource_copy import EduResourceCopy +from flat_api.models.edu_resource_creation import EduResourceCreation +from flat_api.models.edu_resource_folder import EduResourceFolder +from flat_api.models.edu_resource_lti_link import EduResourceLtiLink +from flat_api.models.edu_resource_move import EduResourceMove +from flat_api.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.models.edu_resource_resource import EduResourceResource +from flat_api.models.edu_resource_type import EduResourceType +from flat_api.models.edu_resource_update import EduResourceUpdate +from flat_api.models.edu_resource_use_in_class import EduResourceUseInClass from flat_api.models.flat_error_response import FlatErrorResponse -from flat_api.models.flat_locales import FlatLocales from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework from flat_api.models.google_classroom_submission import GoogleClassroomSubmission +from flat_api.models.grade import Grade from flat_api.models.group import Group +from flat_api.models.group_creation import GroupCreation from flat_api.models.group_details import GroupDetails from flat_api.models.group_type import GroupType from flat_api.models.license_mode import LicenseMode from flat_api.models.license_sources import LicenseSources from flat_api.models.lms_name import LmsName +from flat_api.models.lti_configuration import LtiConfiguration +from flat_api.models.lti_configuration1p1 import LtiConfiguration1p1 +from flat_api.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool +from flat_api.models.lti_configuration1p3 import LtiConfiguration1p3 +from flat_api.models.lti_configuration1p3_base import LtiConfiguration1p3Base +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from flat_api.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment +from flat_api.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic +from flat_api.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual +from flat_api.models.lti_configuration_base import LtiConfigurationBase +from flat_api.models.lti_configuration_create import LtiConfigurationCreate +from flat_api.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 +from flat_api.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment +from flat_api.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic +from flat_api.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo +from flat_api.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual +from flat_api.models.lti_configuration_update import LtiConfigurationUpdate +from flat_api.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment +from flat_api.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone from flat_api.models.lti_credentials import LtiCredentials from flat_api.models.lti_credentials_creation import LtiCredentialsCreation from flat_api.models.media_attachment import MediaAttachment from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode +from flat_api.models.microsoft_graph_assignment import MicrosoftGraphAssignment +from flat_api.models.microsoft_graph_submission import MicrosoftGraphSubmission +from flat_api.models.omr_capabilities import OmrCapabilities +from flat_api.models.omr_details_step_data import OmrDetailsStepData +from flat_api.models.omr_details_submission import OmrDetailsSubmission +from flat_api.models.omr_detected_instrument import OmrDetectedInstrument +from flat_api.models.omr_imported_metadata import OmrImportedMetadata +from flat_api.models.omr_instrument_override import OmrInstrumentOverride +from flat_api.models.omr_job import OmrJob +from flat_api.models.omr_job_creation import OmrJobCreation +from flat_api.models.omr_job_file_metadata import OmrJobFileMetadata +from flat_api.models.omr_job_file_upload import OmrJobFileUpload +from flat_api.models.omr_job_file_upload_result import OmrJobFileUploadResult +from flat_api.models.omr_job_input_file import OmrJobInputFile +from flat_api.models.omr_job_output import OmrJobOutput +from flat_api.models.omr_job_progress import OmrJobProgress +from flat_api.models.omr_job_result import OmrJobResult +from flat_api.models.omr_job_retention import OmrJobRetention +from flat_api.models.omr_job_status import OmrJobStatus +from flat_api.models.omr_locale_details import OmrLocaleDetails +from flat_api.models.omr_pending_step import OmrPendingStep +from flat_api.models.omr_step_name import OmrStepName from flat_api.models.organization_invitation import OrganizationInvitation from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation from flat_api.models.organization_roles import OrganizationRoles +from flat_api.models.organization_user_access_token_creation import OrganizationUserAccessTokenCreation +from flat_api.models.rename_group_request import RenameGroupRequest +from flat_api.models.resource_collaborator import ResourceCollaborator from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation from flat_api.models.resource_rights import ResourceRights -from flat_api.models.resource_sharing_key import ResourceSharingKey from flat_api.models.score_comment import ScoreComment from flat_api.models.score_comment_context import ScoreCommentContext from flat_api.models.score_comment_creation import ScoreCommentCreation +from flat_api.models.score_comment_moderation import ScoreCommentModeration from flat_api.models.score_comment_update import ScoreCommentUpdate from flat_api.models.score_comments_counts import ScoreCommentsCounts from flat_api.models.score_creation import ScoreCreation +from flat_api.models.score_creation_builder_data import ScoreCreationBuilderData +from flat_api.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData +from flat_api.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from flat_api.models.score_creation_common import ScoreCreationCommon +from flat_api.models.score_creation_file_import import ScoreCreationFileImport +from flat_api.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport from flat_api.models.score_creation_type import ScoreCreationType -from flat_api.models.score_data import ScoreData -from flat_api.models.score_data_encoding import ScoreDataEncoding +from flat_api.models.score_details import ScoreDetails +from flat_api.models.score_details_all_of_me import ScoreDetailsAllOfMe from flat_api.models.score_fork import ScoreFork from flat_api.models.score_license import ScoreLicense from flat_api.models.score_likes_counts import ScoreLikesCounts from flat_api.models.score_modification import ScoreModification +from flat_api.models.score_plays_counts import ScorePlaysCounts from flat_api.models.score_privacy import ScorePrivacy from flat_api.models.score_revision import ScoreRevision from flat_api.models.score_revision_creation import ScoreRevisionCreation @@ -79,19 +185,29 @@ from flat_api.models.score_summary import ScoreSummary from flat_api.models.score_track import ScoreTrack from flat_api.models.score_track_creation import ScoreTrackCreation +from flat_api.models.score_track_creation_response import ScoreTrackCreationResponse from flat_api.models.score_track_point import ScoreTrackPoint +from flat_api.models.score_track_purpose import ScoreTrackPurpose from flat_api.models.score_track_state import ScoreTrackState from flat_api.models.score_track_type import ScoreTrackType from flat_api.models.score_track_update import ScoreTrackUpdate from flat_api.models.score_views_counts import ScoreViewsCounts +from flat_api.models.task import Task +from flat_api.models.task_export_options import TaskExportOptions +from flat_api.models.task_progress import TaskProgress +from flat_api.models.task_result import TaskResult +from flat_api.models.teaching_theme import TeachingTheme +from flat_api.models.tutteo_product import TutteoProduct from flat_api.models.user_admin_update import UserAdminUpdate +from flat_api.models.user_azure_details import UserAzureDetails from flat_api.models.user_basics import UserBasics +from flat_api.models.user_community_profile_links import UserCommunityProfileLinks from flat_api.models.user_creation import UserCreation -from flat_api.models.user_details_admin_license import UserDetailsAdminLicense -from flat_api.models.user_instruments import UserInstruments -from flat_api.models.resource_collaborator import ResourceCollaborator -from flat_api.models.score_details import ScoreDetails -from flat_api.models.user_public_summary import UserPublicSummary +from flat_api.models.user_details import UserDetails from flat_api.models.user_details_admin import UserDetailsAdmin +from flat_api.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense from flat_api.models.user_public import UserPublic -from flat_api.models.user_details import UserDetails +from flat_api.models.user_public_summary import UserPublicSummary +from flat_api.models.user_signin_link import UserSigninLink +from flat_api.models.user_signin_link_creation import UserSigninLinkCreation + diff --git a/flat_api/models/add_group_user200_response.py b/flat_api/models/add_group_user200_response.py new file mode 100644 index 0000000..b5bce9e --- /dev/null +++ b/flat_api/models/add_group_user200_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AddGroupUser200Response(BaseModel): + """ + AddGroupUser200Response + """ # noqa: E501 + user: Optional[StrictStr] = Field(default=None, description="User ID that was added") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AddGroupUser200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AddGroupUser200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/add_group_user_request.py b/flat_api/models/add_group_user_request.py new file mode 100644 index 0000000..6225bc6 --- /dev/null +++ b/flat_api/models/add_group_user_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AddGroupUserRequest(BaseModel): + """ + AddGroupUserRequest + """ # noqa: E501 + user: StrictStr = Field(description="ID of the student to add") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AddGroupUserRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AddGroupUserRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/api_access_token.py b/flat_api/models/api_access_token.py new file mode 100644 index 0000000..88fbd2d --- /dev/null +++ b/flat_api/models/api_access_token.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.app_scopes import AppScopes +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ApiAccessToken(BaseModel): + """ + An API access token + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of this private token") + name: Optional[StrictStr] = Field(default=None, description="Name of the personal access token") + token: Optional[StrictStr] = Field(default=None, description="The token. This token will only be returned once, then only the first 4 characters will be returned. ") + issued_date: Optional[datetime] = Field(default=None, description="The date when this token was issued ", alias="issuedDate") + expiration_date: Optional[datetime] = Field(default=None, description="The date when this token will expire ", alias="expirationDate") + scopes: Optional[List[AppScopes]] = Field(default=None, description="The list of scopes associated to the token ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "token", "issuedDate", "expirationDate", "scopes"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiAccessToken from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiAccessToken from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "token": obj.get("token"), + "issuedDate": obj.get("issuedDate"), + "expirationDate": obj.get("expirationDate"), + "scopes": obj.get("scopes") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/app_scopes.py b/flat_api/models/app_scopes.py new file mode 100644 index 0000000..f0207eb --- /dev/null +++ b/flat_api/models/app_scopes.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AppScopes(str, Enum): + """ + Available scopes + """ + + """ + allowed enum values + """ + ACCOUNT_DOT_PUBLIC_PROFILE = 'account.public_profile' + ACCOUNT_DOT_EMAIL = 'account.email' + ACCOUNT_DOT_EDUCATION_PROFILE = 'account.education_profile' + SCORES_DOT_READONLY = 'scores.readonly' + SCORES_DOT_SOCIAL = 'scores.social' + SCORES = 'scores' + COLLECTIONS_DOT_READONLY = 'collections.readonly' + COLLECTIONS_DOT_ADD_SCORES = 'collections.add_scores' + COLLECTIONS = 'collections' + NOTIFICATIONS_DOT_READONLY = 'notifications.readonly' + EDU_DOT_RESOURCES = 'edu.resources' + EDU_DOT_RESOURCES_DOT_READONLY = 'edu.resources.readonly' + EDU_DOT_CLASSES = 'edu.classes' + EDU_DOT_CLASSES_DOT_READONLY = 'edu.classes.readonly' + EDU_DOT_ASSIGNMENTS = 'edu.assignments' + EDU_DOT_ASSIGNMENTS_DOT_READONLY = 'edu.assignments.readonly' + EDU_DOT_ADMIN = 'edu.admin' + EDU_DOT_ADMIN_DOT_LTI = 'edu.admin.lti' + EDU_DOT_ADMIN_DOT_LTI_DOT_READONLY = 'edu.admin.lti.readonly' + EDU_DOT_ADMIN_DOT_USERS = 'edu.admin.users' + EDU_DOT_ADMIN_DOT_USERS_DOT_READONLY = 'edu.admin.users.readonly' + TASKS_DOT_READONLY = 'tasks.readonly' + OMR = 'omr' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AppScopes from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/assignment.py b/flat_api/models/assignment.py index 02915e8..29872e0 100644 --- a/flat_api/models/assignment.py +++ b/flat_api/models/assignment.py @@ -3,396 +3,182 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.assignment_submission import AssignmentSubmission # noqa: F401,E501 -from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework # noqa: F401,E501 -from flat_api.models.media_attachment import MediaAttachment # noqa: F401,E501 - - -class Assignment(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_capabilities import AssignmentCapabilities +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.media_attachment import MediaAttachment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Assignment(BaseModel): """ - swagger_types = { - 'state': 'str', - 'title': 'str', - 'classroom': 'str', - 'description': 'str', - 'attachments': 'list[MediaAttachment]', - 'submissions': 'list[AssignmentSubmission]', - 'creator': 'str', - 'creation_date': 'datetime', - 'scheduled_date': 'datetime', - 'due_date': 'datetime', - 'google_classroom': 'GoogleClassroomCoursework' - } - - attribute_map = { - 'state': 'state', - 'title': 'title', - 'classroom': 'classroom', - 'description': 'description', - 'attachments': 'attachments', - 'submissions': 'submissions', - 'creator': 'creator', - 'creation_date': 'creationDate', - 'scheduled_date': 'scheduledDate', - 'due_date': 'dueDate', - 'google_classroom': 'googleClassroom' - } - - def __init__(self, state=None, title=None, classroom=None, description=None, attachments=None, submissions=None, creator=None, creation_date=None, scheduled_date=None, due_date=None, google_classroom=None): # noqa: E501 - """Assignment - a model defined in Swagger""" # noqa: E501 - - self._state = None - self._title = None - self._classroom = None - self._description = None - self._attachments = None - self._submissions = None - self._creator = None - self._creation_date = None - self._scheduled_date = None - self._due_date = None - self._google_classroom = None - self.discriminator = None - - if state is not None: - self.state = state - if title is not None: - self.title = title - if classroom is not None: - self.classroom = classroom - if description is not None: - self.description = description - if attachments is not None: - self.attachments = attachments - if submissions is not None: - self.submissions = submissions - if creator is not None: - self.creator = creator - if creation_date is not None: - self.creation_date = creation_date - if scheduled_date is not None: - self.scheduled_date = scheduled_date - if due_date is not None: - self.due_date = due_date - if google_classroom is not None: - self.google_classroom = google_classroom - - @property - def state(self): - """Gets the state of this Assignment. # noqa: E501 - - State of the assignment # noqa: E501 - - :return: The state of this Assignment. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this Assignment. - - State of the assignment # noqa: E501 - - :param state: The state of this Assignment. # noqa: E501 - :type: str - """ - allowed_values = ["draft", "active", "archived"] # noqa: E501 - if state not in allowed_values: - raise ValueError( - "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 - .format(state, allowed_values) - ) - - self._state = state - - @property - def title(self): - """Gets the title of this Assignment. # noqa: E501 - - Title of the assignment # noqa: E501 - - :return: The title of this Assignment. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this Assignment. - - Title of the assignment # noqa: E501 - - :param title: The title of this Assignment. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def classroom(self): - """Gets the classroom of this Assignment. # noqa: E501 - - The unique identifier of the class where this assignment was posted # noqa: E501 - - :return: The classroom of this Assignment. # noqa: E501 - :rtype: str - """ - return self._classroom - - @classroom.setter - def classroom(self, classroom): - """Sets the classroom of this Assignment. - - The unique identifier of the class where this assignment was posted # noqa: E501 - - :param classroom: The classroom of this Assignment. # noqa: E501 - :type: str - """ - - self._classroom = classroom - - @property - def description(self): - """Gets the description of this Assignment. # noqa: E501 - - Description and content of the assignment # noqa: E501 - - :return: The description of this Assignment. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this Assignment. - - Description and content of the assignment # noqa: E501 - - :param description: The description of this Assignment. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def attachments(self): - """Gets the attachments of this Assignment. # noqa: E501 - - - :return: The attachments of this Assignment. # noqa: E501 - :rtype: list[MediaAttachment] - """ - return self._attachments - - @attachments.setter - def attachments(self, attachments): - """Sets the attachments of this Assignment. - - - :param attachments: The attachments of this Assignment. # noqa: E501 - :type: list[MediaAttachment] - """ - - self._attachments = attachments - - @property - def submissions(self): - """Gets the submissions of this Assignment. # noqa: E501 - - - :return: The submissions of this Assignment. # noqa: E501 - :rtype: list[AssignmentSubmission] - """ - return self._submissions - - @submissions.setter - def submissions(self, submissions): - """Sets the submissions of this Assignment. - - - :param submissions: The submissions of this Assignment. # noqa: E501 - :type: list[AssignmentSubmission] - """ - - self._submissions = submissions - - @property - def creator(self): - """Gets the creator of this Assignment. # noqa: E501 - - The User unique identifier of the creator of this assignment # noqa: E501 - - :return: The creator of this Assignment. # noqa: E501 - :rtype: str - """ - return self._creator - - @creator.setter - def creator(self, creator): - """Sets the creator of this Assignment. - - The User unique identifier of the creator of this assignment # noqa: E501 - - :param creator: The creator of this Assignment. # noqa: E501 - :type: str - """ - - self._creator = creator - - @property - def creation_date(self): - """Gets the creation_date of this Assignment. # noqa: E501 - - The creation date of this assignment # noqa: E501 - - :return: The creation_date of this Assignment. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this Assignment. - - The creation date of this assignment # noqa: E501 - - :param creation_date: The creation_date of this Assignment. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def scheduled_date(self): - """Gets the scheduled_date of this Assignment. # noqa: E501 - - The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. # noqa: E501 - - :return: The scheduled_date of this Assignment. # noqa: E501 - :rtype: datetime - """ - return self._scheduled_date - - @scheduled_date.setter - def scheduled_date(self, scheduled_date): - """Sets the scheduled_date of this Assignment. - - The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. # noqa: E501 - - :param scheduled_date: The scheduled_date of this Assignment. # noqa: E501 - :type: datetime - """ - - self._scheduled_date = scheduled_date - - @property - def due_date(self): - """Gets the due_date of this Assignment. # noqa: E501 - - The due date of this assignment, late submissions will be marked as paste due. # noqa: E501 - - :return: The due_date of this Assignment. # noqa: E501 - :rtype: datetime - """ - return self._due_date - - @due_date.setter - def due_date(self, due_date): - """Sets the due_date of this Assignment. - - The due date of this assignment, late submissions will be marked as paste due. # noqa: E501 - - :param due_date: The due_date of this Assignment. # noqa: E501 - :type: datetime - """ - - self._due_date = due_date - - @property - def google_classroom(self): - """Gets the google_classroom of this Assignment. # noqa: E501 - - - :return: The google_classroom of this Assignment. # noqa: E501 - :rtype: GoogleClassroomCoursework - """ - return self._google_classroom - - @google_classroom.setter - def google_classroom(self, google_classroom): - """Sets the google_classroom of this Assignment. - - - :param google_classroom: The google_classroom of this Assignment. # noqa: E501 - :type: GoogleClassroomCoursework - """ - - self._google_classroom = google_classroom - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Assignment): - return False + Assignment details + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Assignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Assignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/assignment_capabilities.py b/flat_api/models/assignment_capabilities.py new file mode 100644 index 0000000..fcfc016 --- /dev/null +++ b/flat_api/models/assignment_capabilities.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.assignment_capabilities_can_publish_in_class_error import AssignmentCapabilitiesCanPublishInClassError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCapabilities(BaseModel): + """ + Capabilities the current user has on this assignment. Each capability corresponds to a fine-grained action that a user may take. + """ # noqa: E501 + can_edit: StrictBool = Field(description="Whether the current user can edit the assignment ", alias="canEdit") + can_publish_in_class: StrictBool = Field(description="Whether this assignment can be published in a class ", alias="canPublishInClass") + can_publish_in_class_error: Optional[AssignmentCapabilitiesCanPublishInClassError] = Field(default=None, alias="canPublishInClassError") + can_archive: StrictBool = Field(description="Whether the current user can archive the assignment ", alias="canArchive") + can_unarchive: StrictBool = Field(description="Whether the current user can unarchive the assignment ", alias="canUnarchive") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canPublishInClass", "canPublishInClassError", "canArchive", "canUnarchive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of can_publish_in_class_error + if self.can_publish_in_class_error: + _dict['canPublishInClassError'] = self.can_publish_in_class_error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canPublishInClass": obj.get("canPublishInClass"), + "canPublishInClassError": AssignmentCapabilitiesCanPublishInClassError.from_dict(obj["canPublishInClassError"]) if obj.get("canPublishInClassError") is not None else None, + "canArchive": obj.get("canArchive"), + "canUnarchive": obj.get("canUnarchive") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_capabilities_can_publish_in_class_error.py b/flat_api/models/assignment_capabilities_can_publish_in_class_error.py new file mode 100644 index 0000000..2cefdf8 --- /dev/null +++ b/flat_api/models/assignment_capabilities_can_publish_in_class_error.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCapabilitiesCanPublishInClassError(BaseModel): + """ + If `canPublishInClass` and `canEdit` are false, the issue why this assignment cannot be published in a class + """ # noqa: E501 + code: StrictStr = Field(description="A corresponding code for this error") + message: StrictStr = Field(description="A printable and localized message for this error") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCapabilitiesCanPublishInClassError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCapabilitiesCanPublishInClassError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_copy.py b/flat_api/models/assignment_copy.py index 76ab27b..918cadf 100644 --- a/flat_api/models/assignment_copy.py +++ b/flat_api/models/assignment_copy.py @@ -3,113 +3,136 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class AssignmentCopy(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.assignment_copy_to_class import AssignmentCopyToClass +from flat_api.models.assignment_copy_to_resource_library import AssignmentCopyToResourceLibrary +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self - Do not edit the class manually. - """ +ASSIGNMENTCOPY_ONE_OF_SCHEMAS = ["AssignmentCopyToClass", "AssignmentCopyToResourceLibrary"] +class AssignmentCopy(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + AssignmentCopy """ - swagger_types = { - 'classroom': 'str' - } - - attribute_map = { - 'classroom': 'classroom' - } - - def __init__(self, classroom=None): # noqa: E501 - """AssignmentCopy - a model defined in Swagger""" # noqa: E501 - - self._classroom = None - self.discriminator = None - - self.classroom = classroom - - @property - def classroom(self): - """Gets the classroom of this AssignmentCopy. # noqa: E501 - - The destination classroom where the assignment will be copied # noqa: E501 - - :return: The classroom of this AssignmentCopy. # noqa: E501 - :rtype: str - """ - return self._classroom - - @classroom.setter - def classroom(self, classroom): - """Sets the classroom of this AssignmentCopy. - - The destination classroom where the assignment will be copied # noqa: E501 - - :param classroom: The classroom of this AssignmentCopy. # noqa: E501 - :type: str - """ - if classroom is None: - raise ValueError("Invalid value for `classroom`, must not be `None`") # noqa: E501 - - self._classroom = classroom - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssignmentCopy): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other + # data type: AssignmentCopyToClass + oneof_schema_1_validator: Optional[AssignmentCopyToClass] = None + # data type: AssignmentCopyToResourceLibrary + oneof_schema_2_validator: Optional[AssignmentCopyToResourceLibrary] = None + actual_instance: Optional[Union[AssignmentCopyToClass, AssignmentCopyToResourceLibrary]] = None + one_of_schemas: Set[str] = { "AssignmentCopyToClass", "AssignmentCopyToResourceLibrary" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = AssignmentCopy.model_construct() + error_messages = [] + match = 0 + # validate data type: AssignmentCopyToClass + if not isinstance(v, AssignmentCopyToClass): + error_messages.append(f"Error! Input type `{type(v)}` is not `AssignmentCopyToClass`") + else: + match += 1 + # validate data type: AssignmentCopyToResourceLibrary + if not isinstance(v, AssignmentCopyToResourceLibrary): + error_messages.append(f"Error! Input type `{type(v)}` is not `AssignmentCopyToResourceLibrary`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into AssignmentCopyToClass + try: + instance.actual_instance = AssignmentCopyToClass.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into AssignmentCopyToResourceLibrary + try: + instance.actual_instance = AssignmentCopyToResourceLibrary.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into AssignmentCopy with oneOf schemas: AssignmentCopyToClass, AssignmentCopyToResourceLibrary. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], AssignmentCopyToClass, AssignmentCopyToResourceLibrary]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/assignment_copy_response.py b/flat_api/models/assignment_copy_response.py new file mode 100644 index 0000000..f68ec55 --- /dev/null +++ b/flat_api/models/assignment_copy_response.py @@ -0,0 +1,186 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_capabilities import AssignmentCapabilities +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.media_attachment import MediaAttachment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyResponse(BaseModel): + """ + AssignmentCopyResponse + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + resource: Optional[StrictStr] = Field(default=None, description="If this assignment is stored as a resource in the Flat for Education Resource Library, the unique identifier of the resource.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "resource"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "resource": obj.get("resource") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_copy_to_class.py b/flat_api/models/assignment_copy_to_class.py new file mode 100644 index 0000000..b258cb0 --- /dev/null +++ b/flat_api/models/assignment_copy_to_class.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyToClass(BaseModel): + """ + Copy the assignment to a class + """ # noqa: E501 + classroom: StrictStr = Field(description="The destination classroom where the assignment will be copied") + assignment: Optional[StrictStr] = Field(default=None, description="An optional destination assignment where the original assignment will be copied. Must be a draft.") + scheduled_date: Optional[datetime] = Field(default=None, description="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. ", alias="scheduledDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["classroom", "assignment", "scheduledDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyToClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyToClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "scheduledDate": obj.get("scheduledDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_copy_to_resource_library.py b/flat_api/models/assignment_copy_to_resource_library.py new file mode 100644 index 0000000..85c5932 --- /dev/null +++ b/flat_api/models/assignment_copy_to_resource_library.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentCopyToResourceLibrary(BaseModel): + """ + Copy the assignment to the EDU Resource Library + """ # noqa: E501 + library_parent: StrictStr = Field(description="Identifier of the parent resource where the new one will be created, e.g. a folder id or `root`", alias="libraryParent") + verify_if_not_already_in_resource_library: Optional[StrictBool] = Field(default=None, description="Option to check if the assignment is already in Resource Library", alias="verifyIfNotAlreadyInResourceLibrary") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["libraryParent", "verifyIfNotAlreadyInResourceLibrary"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentCopyToResourceLibrary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentCopyToResourceLibrary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "libraryParent": obj.get("libraryParent"), + "verifyIfNotAlreadyInResourceLibrary": obj.get("verifyIfNotAlreadyInResourceLibrary") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_creation.py b/flat_api/models/assignment_creation.py deleted file mode 100644 index eb87466..0000000 --- a/flat_api/models/assignment_creation.py +++ /dev/null @@ -1,226 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from flat_api.models.class_attachment_creation import ClassAttachmentCreation # noqa: F401,E501 - - -class AssignmentCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'title': 'str', - 'description': 'str', - 'attachments': 'list[ClassAttachmentCreation]', - 'due_date': 'datetime', - 'scheduled_date': 'datetime' - } - - attribute_map = { - 'title': 'title', - 'description': 'description', - 'attachments': 'attachments', - 'due_date': 'dueDate', - 'scheduled_date': 'scheduledDate' - } - - def __init__(self, title=None, description=None, attachments=None, due_date=None, scheduled_date=None): # noqa: E501 - """AssignmentCreation - a model defined in Swagger""" # noqa: E501 - - self._title = None - self._description = None - self._attachments = None - self._due_date = None - self._scheduled_date = None - self.discriminator = None - - if title is not None: - self.title = title - if description is not None: - self.description = description - if attachments is not None: - self.attachments = attachments - if due_date is not None: - self.due_date = due_date - if scheduled_date is not None: - self.scheduled_date = scheduled_date - - @property - def title(self): - """Gets the title of this AssignmentCreation. # noqa: E501 - - Title of the assignment # noqa: E501 - - :return: The title of this AssignmentCreation. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this AssignmentCreation. - - Title of the assignment # noqa: E501 - - :param title: The title of this AssignmentCreation. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def description(self): - """Gets the description of this AssignmentCreation. # noqa: E501 - - Description and content of the assignment # noqa: E501 - - :return: The description of this AssignmentCreation. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this AssignmentCreation. - - Description and content of the assignment # noqa: E501 - - :param description: The description of this AssignmentCreation. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def attachments(self): - """Gets the attachments of this AssignmentCreation. # noqa: E501 - - - :return: The attachments of this AssignmentCreation. # noqa: E501 - :rtype: list[ClassAttachmentCreation] - """ - return self._attachments - - @attachments.setter - def attachments(self, attachments): - """Sets the attachments of this AssignmentCreation. - - - :param attachments: The attachments of this AssignmentCreation. # noqa: E501 - :type: list[ClassAttachmentCreation] - """ - - self._attachments = attachments - - @property - def due_date(self): - """Gets the due_date of this AssignmentCreation. # noqa: E501 - - 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. # noqa: E501 - - :return: The due_date of this AssignmentCreation. # noqa: E501 - :rtype: datetime - """ - return self._due_date - - @due_date.setter - def due_date(self, due_date): - """Sets the due_date of this AssignmentCreation. - - 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. # noqa: E501 - - :param due_date: The due_date of this AssignmentCreation. # noqa: E501 - :type: datetime - """ - - self._due_date = due_date - - @property - def scheduled_date(self): - """Gets the scheduled_date of this AssignmentCreation. # noqa: E501 - - The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. # noqa: E501 - - :return: The scheduled_date of this AssignmentCreation. # noqa: E501 - :rtype: datetime - """ - return self._scheduled_date - - @scheduled_date.setter - def scheduled_date(self, scheduled_date): - """Sets the scheduled_date of this AssignmentCreation. - - The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. # noqa: E501 - - :param scheduled_date: The scheduled_date of this AssignmentCreation. # noqa: E501 - :type: datetime - """ - - self._scheduled_date = scheduled_date - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssignmentCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/assignment_group.py b/flat_api/models/assignment_group.py new file mode 100644 index 0000000..bf63557 --- /dev/null +++ b/flat_api/models/assignment_group.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentGroup(BaseModel): + """ + A group assigned to an assignment for shared writing assignments + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the group") + name: StrictStr = Field(description="The display name of the group") + parent: Optional[StrictStr] = Field(default=None, description="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.") + members: List[StrictStr] = Field(description="Array of user IDs that are members of this group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "parent", "members"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "parent": obj.get("parent"), + "members": obj.get("members") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission.py b/flat_api/models/assignment_submission.py index 60aae08..91a1373 100644 --- a/flat_api/models/assignment_submission.py +++ b/flat_api/models/assignment_submission.py @@ -3,419 +3,179 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.google_classroom_submission import GoogleClassroomSubmission # noqa: F401,E501 -from flat_api.models.media_attachment import MediaAttachment # noqa: F401,E501 - - -class AssignmentSubmission(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_submission_comments import AssignmentSubmissionComments +from flat_api.models.assignment_submission_lti import AssignmentSubmissionLti +from flat_api.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.models.assignment_submission_state import AssignmentSubmissionState +from flat_api.models.google_classroom_submission import GoogleClassroomSubmission +from flat_api.models.media_attachment import MediaAttachment +from flat_api.models.microsoft_graph_submission import MicrosoftGraphSubmission +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmission(BaseModel): """ + Assignment Submission + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the submission") + state: AssignmentSubmissionState + classroom: StrictStr = Field(description="Unique identifier of the classroom where the assignment was posted ") + assignment: StrictStr = Field(description="Unique identifier of the assignment") + creator: StrictStr = Field(description="The User identifier of the student who created the submission") + creation_date: StrictStr = Field(description="The date when the submission was created", alias="creationDate") + attachments: List[MediaAttachment] + submission_date: Optional[StrictStr] = Field(default=None, description="The date when the student submitted their work", alias="submissionDate") + return_date: Optional[StrictStr] = Field(default=None, description="The date when the teacher returned the work", alias="returnDate") + return_creator: Optional[StrictStr] = Field(default=None, description="The User unique identifier of the teacher who returned the submission ", alias="returnCreator") + grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional grade. If unset, no grade was set.") + draft_grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional grade. If unset, no grade was set. This value is only visible to the teacher, and is copied to `grade` once the teacher returns the submission", alias="draftGrade") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Optional max points for the grade. If set, a corresponding `draftGrade` or `grade` will be set.", alias="maxPoints") + exercises_ids: Optional[List[StrictStr]] = Field(default=None, description="The ids of exercises when they need to be in a specific order", alias="exercisesIds") + playback: List[AssignmentSubmissionPlayback] + comments: AssignmentSubmissionComments + google_classroom: Optional[GoogleClassroomSubmission] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[MicrosoftGraphSubmission] = Field(default=None, alias="microsoftGraph") + lti: Optional[AssignmentSubmissionLti] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "classroom", "assignment", "creator", "creationDate", "attachments", "submissionDate", "returnDate", "returnCreator", "grade", "draftGrade", "maxPoints", "exercisesIds", "playback", "comments", "googleClassroom", "microsoftGraph", "lti"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in playback (list) + _items = [] + if self.playback: + for _item_playback in self.playback: + if _item_playback: + _items.append(_item_playback.to_dict()) + _dict['playback'] = _items + # override the default output from pydantic by calling `to_dict()` of comments + if self.comments: + _dict['comments'] = self.comments.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if grade (nullable) is None + # and model_fields_set contains the field + if self.grade is None and "grade" in self.model_fields_set: + _dict['grade'] = None + + # set to None if draft_grade (nullable) is None + # and model_fields_set contains the field + if self.draft_grade is None and "draft_grade" in self.model_fields_set: + _dict['draftGrade'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "submissionDate": obj.get("submissionDate"), + "returnDate": obj.get("returnDate"), + "returnCreator": obj.get("returnCreator"), + "grade": obj.get("grade"), + "draftGrade": obj.get("draftGrade"), + "maxPoints": obj.get("maxPoints"), + "exercisesIds": obj.get("exercisesIds"), + "playback": [AssignmentSubmissionPlayback.from_dict(_item) for _item in obj["playback"]] if obj.get("playback") is not None else None, + "comments": AssignmentSubmissionComments.from_dict(obj["comments"]) if obj.get("comments") is not None else None, + "googleClassroom": GoogleClassroomSubmission.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": MicrosoftGraphSubmission.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "lti": AssignmentSubmissionLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'classroom': 'str', - 'assignment': 'str', - 'creator': 'str', - 'creation_date': 'str', - 'attachments': 'list[MediaAttachment]', - 'submission_date': 'str', - 'student_comment': 'str', - 'return_date': 'str', - 'return_feedback': 'str', - 'return_creator': 'str', - 'google_classroom': 'GoogleClassroomSubmission' - } - - attribute_map = { - 'id': 'id', - 'classroom': 'classroom', - 'assignment': 'assignment', - 'creator': 'creator', - 'creation_date': 'creationDate', - 'attachments': 'attachments', - 'submission_date': 'submissionDate', - 'student_comment': 'studentComment', - 'return_date': 'returnDate', - 'return_feedback': 'returnFeedback', - 'return_creator': 'returnCreator', - 'google_classroom': 'googleClassroom' - } - - def __init__(self, id=None, classroom=None, assignment=None, creator=None, creation_date=None, attachments=None, submission_date=None, student_comment=None, return_date=None, return_feedback=None, return_creator=None, google_classroom=None): # noqa: E501 - """AssignmentSubmission - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._classroom = None - self._assignment = None - self._creator = None - self._creation_date = None - self._attachments = None - self._submission_date = None - self._student_comment = None - self._return_date = None - self._return_feedback = None - self._return_creator = None - self._google_classroom = None - self.discriminator = None - - if id is not None: - self.id = id - if classroom is not None: - self.classroom = classroom - if assignment is not None: - self.assignment = assignment - if creator is not None: - self.creator = creator - if creation_date is not None: - self.creation_date = creation_date - if attachments is not None: - self.attachments = attachments - if submission_date is not None: - self.submission_date = submission_date - if student_comment is not None: - self.student_comment = student_comment - if return_date is not None: - self.return_date = return_date - if return_feedback is not None: - self.return_feedback = return_feedback - if return_creator is not None: - self.return_creator = return_creator - if google_classroom is not None: - self.google_classroom = google_classroom - - @property - def id(self): - """Gets the id of this AssignmentSubmission. # noqa: E501 - - Unique identifier of the submission # noqa: E501 - - :return: The id of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this AssignmentSubmission. - - Unique identifier of the submission # noqa: E501 - - :param id: The id of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def classroom(self): - """Gets the classroom of this AssignmentSubmission. # noqa: E501 - - Unique identifier of the classroom where the assignment was posted # noqa: E501 - - :return: The classroom of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._classroom - - @classroom.setter - def classroom(self, classroom): - """Sets the classroom of this AssignmentSubmission. - - Unique identifier of the classroom where the assignment was posted # noqa: E501 - - :param classroom: The classroom of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._classroom = classroom - - @property - def assignment(self): - """Gets the assignment of this AssignmentSubmission. # noqa: E501 - - Unique identifier of the assignment # noqa: E501 - - :return: The assignment of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._assignment - - @assignment.setter - def assignment(self, assignment): - """Sets the assignment of this AssignmentSubmission. - - Unique identifier of the assignment # noqa: E501 - - :param assignment: The assignment of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._assignment = assignment - - @property - def creator(self): - """Gets the creator of this AssignmentSubmission. # noqa: E501 - - The User identifier of the student who created the submission # noqa: E501 - - :return: The creator of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._creator - - @creator.setter - def creator(self, creator): - """Sets the creator of this AssignmentSubmission. - - The User identifier of the student who created the submission # noqa: E501 - - :param creator: The creator of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._creator = creator - - @property - def creation_date(self): - """Gets the creation_date of this AssignmentSubmission. # noqa: E501 - - The date when the submission was created # noqa: E501 - - :return: The creation_date of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this AssignmentSubmission. - - The date when the submission was created # noqa: E501 - - :param creation_date: The creation_date of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._creation_date = creation_date - - @property - def attachments(self): - """Gets the attachments of this AssignmentSubmission. # noqa: E501 - - - :return: The attachments of this AssignmentSubmission. # noqa: E501 - :rtype: list[MediaAttachment] - """ - return self._attachments - - @attachments.setter - def attachments(self, attachments): - """Sets the attachments of this AssignmentSubmission. - - - :param attachments: The attachments of this AssignmentSubmission. # noqa: E501 - :type: list[MediaAttachment] - """ - - self._attachments = attachments - - @property - def submission_date(self): - """Gets the submission_date of this AssignmentSubmission. # noqa: E501 - - The date when the student submitted his work # noqa: E501 - - :return: The submission_date of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._submission_date - - @submission_date.setter - def submission_date(self, submission_date): - """Sets the submission_date of this AssignmentSubmission. - - The date when the student submitted his work # noqa: E501 - - :param submission_date: The submission_date of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._submission_date = submission_date - - @property - def student_comment(self): - """Gets the student_comment of this AssignmentSubmission. # noqa: E501 - - An optionnal comment sent by the student when submitting his work # noqa: E501 - - :return: The student_comment of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._student_comment - - @student_comment.setter - def student_comment(self, student_comment): - """Sets the student_comment of this AssignmentSubmission. - - An optionnal comment sent by the student when submitting his work # noqa: E501 - - :param student_comment: The student_comment of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._student_comment = student_comment - - @property - def return_date(self): - """Gets the return_date of this AssignmentSubmission. # noqa: E501 - - The date when the teacher returned the work # noqa: E501 - - :return: The return_date of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._return_date - - @return_date.setter - def return_date(self, return_date): - """Sets the return_date of this AssignmentSubmission. - - The date when the teacher returned the work # noqa: E501 - - :param return_date: The return_date of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._return_date = return_date - - @property - def return_feedback(self): - """Gets the return_feedback of this AssignmentSubmission. # noqa: E501 - - The feedback associated with the return # noqa: E501 - - :return: The return_feedback of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._return_feedback - - @return_feedback.setter - def return_feedback(self, return_feedback): - """Sets the return_feedback of this AssignmentSubmission. - - The feedback associated with the return # noqa: E501 - - :param return_feedback: The return_feedback of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._return_feedback = return_feedback - - @property - def return_creator(self): - """Gets the return_creator of this AssignmentSubmission. # noqa: E501 - - The User unique identifier of the teacher who returned the submission # noqa: E501 - - :return: The return_creator of this AssignmentSubmission. # noqa: E501 - :rtype: str - """ - return self._return_creator - - @return_creator.setter - def return_creator(self, return_creator): - """Sets the return_creator of this AssignmentSubmission. - - The User unique identifier of the teacher who returned the submission # noqa: E501 - - :param return_creator: The return_creator of this AssignmentSubmission. # noqa: E501 - :type: str - """ - - self._return_creator = return_creator - - @property - def google_classroom(self): - """Gets the google_classroom of this AssignmentSubmission. # noqa: E501 - - - :return: The google_classroom of this AssignmentSubmission. # noqa: E501 - :rtype: GoogleClassroomSubmission - """ - return self._google_classroom - - @google_classroom.setter - def google_classroom(self, google_classroom): - """Sets the google_classroom of this AssignmentSubmission. - - - :param google_classroom: The google_classroom of this AssignmentSubmission. # noqa: E501 - :type: GoogleClassroomSubmission - """ - - self._google_classroom = google_classroom - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssignmentSubmission): - return False - - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/assignment_submission_comment.py b/flat_api/models/assignment_submission_comment.py new file mode 100644 index 0000000..8082328 --- /dev/null +++ b/flat_api/models/assignment_submission_comment.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionComment(BaseModel): + """ + Feedback comment added to an assignment submission + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The comment unique identifier") + user: Optional[StrictStr] = Field(default=None, description="The author unique identifier") + submission: Optional[StrictStr] = Field(default=None, description="The submission unique identifier") + var_date: Optional[datetime] = Field(default=None, description="The date when the comment was posted", alias="date") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last comment modification", alias="modificationDate") + comment: Optional[StrictStr] = Field(default=None, description="The comment text") + unread: Optional[StrictBool] = Field(default=None, description="True if the comment is unread by the current user") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "user", "submission", "date", "modificationDate", "comment", "unread"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "user": obj.get("user"), + "submission": obj.get("submission"), + "date": obj.get("date"), + "modificationDate": obj.get("modificationDate"), + "comment": obj.get("comment"), + "unread": obj.get("unread") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_comment_creation.py b/flat_api/models/assignment_submission_comment_creation.py new file mode 100644 index 0000000..86e1266 --- /dev/null +++ b/flat_api/models/assignment_submission_comment_creation.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionCommentCreation(BaseModel): + """ + Creation of an assignment submission comment + """ # noqa: E501 + comment: StrictStr = Field(description="The comment text") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["comment"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionCommentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionCommentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "comment": obj.get("comment") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_comments.py b/flat_api/models/assignment_submission_comments.py new file mode 100644 index 0000000..5b1f518 --- /dev/null +++ b/flat_api/models/assignment_submission_comments.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionComments(BaseModel): + """ + AssignmentSubmissionComments + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of comments added to the submission") + unread: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of unread comments for the current user") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "unread"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionComments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "unread": obj.get("unread") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_history.py b/flat_api/models/assignment_submission_history.py new file mode 100644 index 0000000..0ce51b3 --- /dev/null +++ b/flat_api/models/assignment_submission_history.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_submission_history_attachment import AssignmentSubmissionHistoryAttachment +from flat_api.models.assignment_submission_history_state import AssignmentSubmissionHistoryState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionHistory(BaseModel): + """ + History item of the submission + """ # noqa: E501 + var_date: datetime = Field(description="The date when the submission was changed", alias="date") + classroom: Optional[StrictStr] = Field(default=None, description="The classroom unique identifier where the submission was changed") + assignment: Optional[StrictStr] = Field(default=None, description="The assignment unique identifier where the submission was changed") + submission: Optional[StrictStr] = Field(default=None, description="The submission unique identifier") + users: List[StrictStr] = Field(description="The user(s) unique identifier(s) who made the change") + source: Optional[StrictStr] = Field(default=None, description="The source of the change if the change was made by a third-party software") + state: Optional[AssignmentSubmissionHistoryState] = None + draft_grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The numerator of the grade at this time in the submission grade history", alias="draftGrade") + grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The numerator of the grade at this time in the submission grade history") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The denominator of the grade at this time in the submission grade history", alias="maxPoints") + comment: Optional[StrictStr] = Field(default=None, description="The comment that is made to this submission") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment", alias="dueDate") + attachment: Optional[AssignmentSubmissionHistoryAttachment] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["date", "classroom", "assignment", "submission", "users", "source", "state", "draftGrade", "grade", "maxPoints", "comment", "dueDate", "attachment"] + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['lti', 'googleClassroom', 'microsoftGraph']): + raise ValueError("must be one of enum values ('lti', 'googleClassroom', 'microsoftGraph')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of attachment + if self.attachment: + _dict['attachment'] = self.attachment.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "submission": obj.get("submission"), + "users": obj.get("users"), + "source": obj.get("source"), + "state": obj.get("state"), + "draftGrade": obj.get("draftGrade"), + "grade": obj.get("grade"), + "maxPoints": obj.get("maxPoints"), + "comment": obj.get("comment"), + "dueDate": obj.get("dueDate"), + "attachment": AssignmentSubmissionHistoryAttachment.from_dict(obj["attachment"]) if obj.get("attachment") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_history_attachment.py b/flat_api/models/assignment_submission_history_attachment.py new file mode 100644 index 0000000..3fae711 --- /dev/null +++ b/flat_api/models/assignment_submission_history_attachment.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionHistoryAttachment(BaseModel): + """ + AssignmentSubmissionHistoryAttachment + """ # noqa: E501 + score: Optional[StrictStr] = Field(default=None, description="The score identifier that changed") + revision: Optional[StrictStr] = Field(default=None, description="The revision identifier that changed") + title: Optional[StrictStr] = Field(default=None, description="The title of the score that changed") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "revision", "title"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistoryAttachment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionHistoryAttachment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "revision": obj.get("revision"), + "title": obj.get("title") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_history_state.py b/flat_api/models/assignment_submission_history_state.py new file mode 100644 index 0000000..810de63 --- /dev/null +++ b/flat_api/models/assignment_submission_history_state.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionHistoryState(str, Enum): + """ + State of the submission history + """ + + """ + allowed enum values + """ + CREATED = 'created' + TURNEDIN = 'turnedIn' + RETURNED = 'returned' + GRADED = 'graded' + RESET = 'reset' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionHistoryState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/assignment_submission_lti.py b/flat_api/models/assignment_submission_lti.py new file mode 100644 index 0000000..d0076d3 --- /dev/null +++ b/flat_api/models/assignment_submission_lti.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionLti(BaseModel): + """ + If set, this submission has a linked LTI 1.3 AGS or LTI 1.1 Outcomes + """ # noqa: E501 + grade_service: StrictStr = Field(description="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 ", alias="gradeService") + sourcedid: Optional[StrictStr] = Field(default=None, description="The sourcedid of the LTI submission when using LTI Outcomes") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["gradeService", "sourcedid"] + + @field_validator('grade_service') + def grade_service_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ags2p0', 'outcomes1p1']): + raise ValueError("must be one of enum values ('ags2p0', 'outcomes1p1')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "gradeService": obj.get("gradeService"), + "sourcedid": obj.get("sourcedid") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_playback.py b/flat_api/models/assignment_submission_playback.py new file mode 100644 index 0000000..5713ea1 --- /dev/null +++ b/flat_api/models/assignment_submission_playback.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionPlayback(BaseModel): + """ + Playback used by a student for an assignment submission. + """ # noqa: E501 + score: StrictStr = Field(description="The score unique identifier") + nb_play_attempt: Union[StrictFloat, StrictInt] = Field(description="Number of times the score was played", alias="nbPlayAttempt") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "nbPlayAttempt"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionPlayback from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionPlayback from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "nbPlayAttempt": obj.get("nbPlayAttempt") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/assignment_submission_state.py b/flat_api/models/assignment_submission_state.py new file mode 100644 index 0000000..d591dc8 --- /dev/null +++ b/flat_api/models/assignment_submission_state.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionState(str, Enum): + """ + State of the submission + """ + + """ + allowed enum values + """ + CREATED = 'created' + TURNEDIN = 'turnedIn' + RETURNED = 'returned' + GRADED = 'graded' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionState from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/assignment_submission_students_mode.py b/flat_api/models/assignment_submission_students_mode.py new file mode 100644 index 0000000..0838698 --- /dev/null +++ b/flat_api/models/assignment_submission_students_mode.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentSubmissionStudentsMode(str, Enum): + """ + Submission mode for assignments: - \"single\": Individual submissions (default) - \"group\": Group submissions (for shared writing assignments) + """ + + """ + allowed enum values + """ + SINGLE = 'single' + GROUP = 'group' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentSubmissionStudentsMode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/assignment_submission_update.py b/flat_api/models/assignment_submission_update.py index dfe0593..10313c3 100644 --- a/flat_api/models/assignment_submission_update.py +++ b/flat_api/models/assignment_submission_update.py @@ -3,196 +3,144 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_attachment_creation import ClassAttachmentCreation # noqa: F401,E501 - - -class AssignmentSubmissionUpdate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.assignment_submission_playback import AssignmentSubmissionPlayback +from flat_api.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentSubmissionUpdate(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'attachments': 'list[ClassAttachmentCreation]', - 'student_comment': 'str', - 'submit': 'bool', - 'return_feedback': 'str' - } - - attribute_map = { - 'attachments': 'attachments', - 'student_comment': 'studentComment', - 'submit': 'submit', - 'return_feedback': 'returnFeedback' - } - - def __init__(self, attachments=None, student_comment=None, submit=None, return_feedback=None): # noqa: E501 - """AssignmentSubmissionUpdate - a model defined in Swagger""" # noqa: E501 - - self._attachments = None - self._student_comment = None - self._submit = None - self._return_feedback = None - self.discriminator = None - - if attachments is not None: - self.attachments = attachments - if student_comment is not None: - self.student_comment = student_comment - if submit is not None: - self.submit = submit - if return_feedback is not None: - self.return_feedback = return_feedback - - @property - def attachments(self): - """Gets the attachments of this AssignmentSubmissionUpdate. # noqa: E501 - - - :return: The attachments of this AssignmentSubmissionUpdate. # noqa: E501 - :rtype: list[ClassAttachmentCreation] - """ - return self._attachments - - @attachments.setter - def attachments(self, attachments): - """Sets the attachments of this AssignmentSubmissionUpdate. - - - :param attachments: The attachments of this AssignmentSubmissionUpdate. # noqa: E501 - :type: list[ClassAttachmentCreation] - """ - - self._attachments = attachments - - @property - def student_comment(self): - """Gets the student_comment of this AssignmentSubmissionUpdate. # noqa: E501 - - An optionnal comment sent by the student when submitting his work # noqa: E501 - - :return: The student_comment of this AssignmentSubmissionUpdate. # noqa: E501 - :rtype: str + Assignment Submission creation + """ # noqa: E501 + attachments: Optional[List[ClassAttachmentCreation]] = None + playback: Optional[List[AssignmentSubmissionPlayback]] = None + submit: Optional[StrictBool] = Field(default=None, description="If `true`, the submission will be marked as done") + draft_grade: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="Optional grade. If unset, no grade was set. This value is only visible to the teacher, and is copied to `grade` once the teacher returns the submission", alias="draftGrade") + grade: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="Optional grade. If unset, no grade was set.") + exercises_ids: Optional[List[StrictStr]] = Field(default=None, description="The ids of exercises when they need to be in a specific order", alias="exercisesIds") + var_return: Optional[StrictBool] = Field(default=None, description="If `true`, the submission will be returned to the student (teachers only)", alias="return") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["attachments", "playback", "submit", "draftGrade", "grade", "exercisesIds", "return"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentSubmissionUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._student_comment + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in playback (list) + _items = [] + if self.playback: + for _item_playback in self.playback: + if _item_playback: + _items.append(_item_playback.to_dict()) + _dict['playback'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if draft_grade (nullable) is None + # and model_fields_set contains the field + if self.draft_grade is None and "draft_grade" in self.model_fields_set: + _dict['draftGrade'] = None + + # set to None if grade (nullable) is None + # and model_fields_set contains the field + if self.grade is None and "grade" in self.model_fields_set: + _dict['grade'] = None + + # set to None if exercises_ids (nullable) is None + # and model_fields_set contains the field + if self.exercises_ids is None and "exercises_ids" in self.model_fields_set: + _dict['exercisesIds'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentSubmissionUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "playback": [AssignmentSubmissionPlayback.from_dict(_item) for _item in obj["playback"]] if obj.get("playback") is not None else None, + "submit": obj.get("submit"), + "draftGrade": obj.get("draftGrade"), + "grade": obj.get("grade"), + "exercisesIds": obj.get("exercisesIds"), + "return": obj.get("return") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @student_comment.setter - def student_comment(self, student_comment): - """Sets the student_comment of this AssignmentSubmissionUpdate. - - An optionnal comment sent by the student when submitting his work # noqa: E501 - - :param student_comment: The student_comment of this AssignmentSubmissionUpdate. # noqa: E501 - :type: str - """ - - self._student_comment = student_comment - - @property - def submit(self): - """Gets the submit of this AssignmentSubmissionUpdate. # noqa: E501 - - If `true`, the submission will be marked as done # noqa: E501 - - :return: The submit of this AssignmentSubmissionUpdate. # noqa: E501 - :rtype: bool - """ - return self._submit - - @submit.setter - def submit(self, submit): - """Sets the submit of this AssignmentSubmissionUpdate. - - If `true`, the submission will be marked as done # noqa: E501 - - :param submit: The submit of this AssignmentSubmissionUpdate. # noqa: E501 - :type: bool - """ - - self._submit = submit - - @property - def return_feedback(self): - """Gets the return_feedback of this AssignmentSubmissionUpdate. # noqa: E501 - - The feedback associated with the return # noqa: E501 - - :return: The return_feedback of this AssignmentSubmissionUpdate. # noqa: E501 - :rtype: str - """ - return self._return_feedback - - @return_feedback.setter - def return_feedback(self, return_feedback): - """Sets the return_feedback of this AssignmentSubmissionUpdate. - - The feedback associated with the return # noqa: E501 - - :param return_feedback: The return_feedback of this AssignmentSubmissionUpdate. # noqa: E501 - :type: str - """ - self._return_feedback = return_feedback - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssignmentSubmissionUpdate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/assignment_type.py b/flat_api/models/assignment_type.py new file mode 100644 index 0000000..b4d3b26 --- /dev/null +++ b/flat_api/models/assignment_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AssignmentType(str, Enum): + """ + Type of the assignment + """ + + """ + allowed enum values + """ + NONE = 'none' + NEWSCORE = 'newScore' + SCORETEMPLATE = 'scoreTemplate' + SHAREDWRITING = 'sharedWriting' + WORKSHEET = 'worksheet' + WORKSHEETTEXT = 'worksheetText' + PERFORMANCE = 'performance' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AssignmentType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/assignment_update.py b/flat_api/models/assignment_update.py new file mode 100644 index 0000000..9cb6026 --- /dev/null +++ b/flat_api/models/assignment_update.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AssignmentUpdate(BaseModel): + """ + Assignment Resource Editing + """ # noqa: E501 + type: Optional[AssignmentType] = None + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the assignment") + description: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Teacher-only instructions (plain text)", alias="teacherInstructions") + teacher_instructions_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + attachments: Optional[List[ClassAttachmentCreation]] = Field(default=None, description="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`. ") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + toolset: Optional[StrictStr] = Field(default=None, description="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. ") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + max_points: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="If set, the grading will be enabled for the assignment with this value as the maximum of points ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "attachments", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "toolset", "coverFile", "cover", "maxPoints", "releaseGrades", "shuffleExercises", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssignmentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if nb_playback_authorized (nullable) is None + # and model_fields_set contains the field + if self.nb_playback_authorized is None and "nb_playback_authorized" in self.model_fields_set: + _dict['nbPlaybackAuthorized'] = None + + # set to None if toolset (nullable) is None + # and model_fields_set contains the field + if self.toolset is None and "toolset" in self.model_fields_set: + _dict['toolset'] = None + + # set to None if cover_file (nullable) is None + # and model_fields_set contains the field + if self.cover_file is None and "cover_file" in self.model_fields_set: + _dict['coverFile'] = None + + # set to None if cover (nullable) is None + # and model_fields_set contains the field + if self.cover is None and "cover" in self.model_fields_set: + _dict['cover'] = None + + # set to None if max_points (nullable) is None + # and model_fields_set contains the field + if self.max_points is None and "max_points" in self.model_fields_set: + _dict['maxPoints'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssignmentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "toolset": obj.get("toolset"), + "coverFile": obj.get("coverFile"), + "cover": obj.get("cover"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment.py b/flat_api/models/class_assignment.py new file mode 100644 index 0000000..1dc219b --- /dev/null +++ b/flat_api/models/class_assignment.py @@ -0,0 +1,270 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_capabilities import AssignmentCapabilities +from flat_api.models.assignment_group import AssignmentGroup +from flat_api.models.assignment_submission import AssignmentSubmission +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.class_assignment_all_of_canvas import ClassAssignmentAllOfCanvas +from flat_api.models.class_assignment_all_of_lti import ClassAssignmentAllOfLti +from flat_api.models.class_assignment_all_of_mfc import ClassAssignmentAllOfMfc +from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework +from flat_api.models.media_attachment import MediaAttachment +from flat_api.models.microsoft_graph_assignment import MicrosoftGraphAssignment +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignment(BaseModel): + """ + ClassAssignment + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the assignment") + type: AssignmentType + capabilities: AssignmentCapabilities + title: StrictStr = Field(description="Title of the assignment") + description: Optional[StrictStr] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructions") + teacher_instructions_html: Optional[StrictStr] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + attachments: List[MediaAttachment] = Field(description="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: Optional[StrictBool] = Field(default=None, description="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. ", alias="useDedicatedAttachments") + max_points: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If set, the grading will be enabled for the assignment ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + toolset: Optional[StrictStr] = Field(default=None, description="The id of the associated toolset") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + creator: Optional[StrictStr] = Field(default=None, description="The User unique identifier of the creator of this assignment ") + state: StrictStr = Field(description="State of the assignment") + classroom: Optional[StrictStr] = Field(default=None, description="The unique identifier of the class where this assignment was posted") + creation_date: datetime = Field(description="The creation date of this assignment", alias="creationDate") + scheduled_date: Optional[datetime] = Field(default=None, description="The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. ", alias="scheduledDate") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment, late submissions will be marked as past due. ", alias="dueDate") + assignee_mode: Optional[StrictStr] = Field(default=None, description="Possible modes of assigning assignments", alias="assigneeMode") + assigned_students: Optional[List[StrictStr]] = Field(default=None, description="Identifiers for the students that have access to the assignment", alias="assignedStudents") + assigned_groups: Optional[List[AssignmentGroup]] = Field(default=None, description="Groups that have access to the assignment (for shared writing assignments)", alias="assignedGroups") + submissions: List[AssignmentSubmission] + google_classroom: Optional[GoogleClassroomCoursework] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[MicrosoftGraphAssignment] = Field(default=None, alias="microsoftGraph") + mfc: Optional[ClassAssignmentAllOfMfc] = None + canvas: Optional[ClassAssignmentAllOfCanvas] = None + lti: Optional[ClassAssignmentAllOfLti] = None + issue: Optional[StrictStr] = Field(default=None, description="Detected issue for this assignment") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "capabilities", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "cover", "coverFile", "attachments", "useDedicatedAttachments", "maxPoints", "releaseGrades", "shuffleExercises", "toolset", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "creator", "state", "classroom", "creationDate", "scheduledDate", "dueDate", "assigneeMode", "assignedStudents", "assignedGroups", "submissions", "googleClassroom", "microsoftGraph", "mfc", "canvas", "lti", "issue"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['draft', 'active', 'archived']): + raise ValueError("must be one of enum values ('draft', 'active', 'archived')") + return value + + @field_validator('assignee_mode') + def assignee_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['everyone', 'selected']): + raise ValueError("must be one of enum values ('everyone', 'selected')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in assigned_groups (list) + _items = [] + if self.assigned_groups: + for _item_assigned_groups in self.assigned_groups: + if _item_assigned_groups: + _items.append(_item_assigned_groups.to_dict()) + _dict['assignedGroups'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in submissions (list) + _items = [] + if self.submissions: + for _item_submissions in self.submissions: + if _item_submissions: + _items.append(_item_submissions.to_dict()) + _dict['submissions'] = _items + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of mfc + if self.mfc: + _dict['mfc'] = self.mfc.to_dict() + # override the default output from pydantic by calling `to_dict()` of canvas + if self.canvas: + _dict['canvas'] = self.canvas.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "capabilities": AssignmentCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "cover": obj.get("cover"), + "coverFile": obj.get("coverFile"), + "attachments": [MediaAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "useDedicatedAttachments": obj.get("useDedicatedAttachments"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "toolset": obj.get("toolset"), + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "creator": obj.get("creator"), + "state": obj.get("state"), + "classroom": obj.get("classroom"), + "creationDate": obj.get("creationDate"), + "scheduledDate": obj.get("scheduledDate"), + "dueDate": obj.get("dueDate"), + "assigneeMode": obj.get("assigneeMode"), + "assignedStudents": obj.get("assignedStudents"), + "assignedGroups": [AssignmentGroup.from_dict(_item) for _item in obj["assignedGroups"]] if obj.get("assignedGroups") is not None else None, + "submissions": [AssignmentSubmission.from_dict(_item) for _item in obj["submissions"]] if obj.get("submissions") is not None else None, + "googleClassroom": GoogleClassroomCoursework.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": MicrosoftGraphAssignment.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "mfc": ClassAssignmentAllOfMfc.from_dict(obj["mfc"]) if obj.get("mfc") is not None else None, + "canvas": ClassAssignmentAllOfCanvas.from_dict(obj["canvas"]) if obj.get("canvas") is not None else None, + "lti": ClassAssignmentAllOfLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None, + "issue": obj.get("issue") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_all_of_canvas.py b/flat_api/models/class_assignment_all_of_canvas.py new file mode 100644 index 0000000..89d5f23 --- /dev/null +++ b/flat_api/models/class_assignment_all_of_canvas.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfCanvas(BaseModel): + """ + A Canvas LMS assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the assignment on Canvas") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to Canvas assignment", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfCanvas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfCanvas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_all_of_lti.py b/flat_api/models/class_assignment_all_of_lti.py new file mode 100644 index 0000000..3a01e9a --- /dev/null +++ b/flat_api/models/class_assignment_all_of_lti.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfLti(BaseModel): + """ + An LTI assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Resource ID in the LMS") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_all_of_mfc.py b/flat_api/models/class_assignment_all_of_mfc.py new file mode 100644 index 0000000..32db1fe --- /dev/null +++ b/flat_api/models/class_assignment_all_of_mfc.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentAllOfMfc(BaseModel): + """ + A MusicFirst Classroom assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the task on MusicFirst Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to MusicFirst Classroom task", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfMfc from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentAllOfMfc from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_update.py b/flat_api/models/class_assignment_update.py new file mode 100644 index 0000000..1a7c24e --- /dev/null +++ b/flat_api/models/class_assignment_update.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.assignment_submission_students_mode import AssignmentSubmissionStudentsMode +from flat_api.models.assignment_type import AssignmentType +from flat_api.models.class_assignment_update_all_of_google_classroom import ClassAssignmentUpdateAllOfGoogleClassroom +from flat_api.models.class_assignment_update_all_of_microsoft_graph import ClassAssignmentUpdateAllOfMicrosoftGraph +from flat_api.models.class_attachment_creation import ClassAttachmentCreation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdate(BaseModel): + """ + ClassAssignmentUpdate + """ # noqa: E501 + type: Optional[AssignmentType] = None + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the assignment") + description: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Student instructions and content of the assignment (plain text)") + description_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="descriptionHtml") + teacher_instructions: Optional[Annotated[str, Field(strict=True, max_length=100000)]] = Field(default=None, description="Teacher-only instructions (plain text)", alias="teacherInstructions") + teacher_instructions_html: Optional[Annotated[str, Field(strict=True, max_length=20000000)]] = Field(default=None, description="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. ", alias="teacherInstructionsHtml") + attachments: Optional[List[ClassAttachmentCreation]] = Field(default=None, description="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`. ") + nb_playback_authorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of playbacks authorized on the scores of the assignment.", alias="nbPlaybackAuthorized") + restrict_play_note: Optional[StrictBool] = Field(default=None, description="Restrict the ability to get an audio feedback every time a student adds or selects a note.", alias="restrictPlayNote") + restrict_to_audio_tracks: Optional[StrictBool] = Field(default=None, description="Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.", alias="restrictToAudioTracks") + toolset: Optional[StrictStr] = Field(default=None, description="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. ") + cover_file: Optional[StrictStr] = Field(default=None, description="The id of the cover to display", alias="coverFile") + cover: Optional[StrictStr] = Field(default=None, description="The URL of the cover to display") + max_points: Optional[Union[Annotated[float, Field(le=10000, strict=True, ge=0)], Annotated[int, Field(le=10000, strict=True, ge=0)]]] = Field(default=None, description="If set, the grading will be enabled for the assignment with this value as the maximum of points ", alias="maxPoints") + release_grades: Optional[StrictStr] = Field(default=None, description="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 ", alias="releaseGrades") + shuffle_exercises: Optional[StrictBool] = Field(default=None, description="Shuffle the worksheet exercises for each student", alias="shuffleExercises") + submission_students_mode: Optional[AssignmentSubmissionStudentsMode] = Field(default=None, alias="submissionStudentsMode") + recording_type: Optional[StrictStr] = Field(default=None, description="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'. ", alias="recordingType") + allow_metronome: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'. ", alias="allowMetronome") + allow_backing_track: Optional[StrictBool] = Field(default=None, description="For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'. ", alias="allowBackingTrack") + allow_speed_change: Optional[StrictBool] = Field(default=None, description="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'. ", alias="allowSpeedChange") + free_record: Optional[StrictBool] = Field(default=None, description="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'. ", alias="freeRecord") + state: Optional[StrictStr] = Field(default=None, description="State of the assignment") + due_date: Optional[datetime] = Field(default=None, description="The due date of this assignment, late submissions will be marked as past due. If not set, the assignment won't have a due date. ", alias="dueDate") + scheduled_date: Optional[datetime] = Field(default=None, description="The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class. ", alias="scheduledDate") + google_classroom: Optional[ClassAssignmentUpdateAllOfGoogleClassroom] = Field(default=None, alias="googleClassroom") + microsoft_graph: Optional[ClassAssignmentUpdateAllOfMicrosoftGraph] = Field(default=None, alias="microsoftGraph") + assignee_mode: Optional[StrictStr] = Field(default=None, description="Possible modes of assigning assignments", alias="assigneeMode") + assigned_students: Optional[List[StrictStr]] = Field(default=None, description="Identifiers for the students that have access to the assignment", alias="assignedStudents") + class_group_ids: Optional[List[StrictStr]] = Field(default=None, description="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 ", alias="classGroupIds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "description", "descriptionHtml", "teacherInstructions", "teacherInstructionsHtml", "attachments", "nbPlaybackAuthorized", "restrictPlayNote", "restrictToAudioTracks", "toolset", "coverFile", "cover", "maxPoints", "releaseGrades", "shuffleExercises", "submissionStudentsMode", "recordingType", "allowMetronome", "allowBackingTrack", "allowSpeedChange", "freeRecord", "state", "dueDate", "scheduledDate", "googleClassroom", "microsoftGraph", "assigneeMode", "assignedStudents", "classGroupIds"] + + @field_validator('release_grades') + def release_grades_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto', 'manual']): + raise ValueError("must be one of enum values ('auto', 'manual')") + return value + + @field_validator('recording_type') + def recording_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['audio', 'video']): + raise ValueError("must be one of enum values ('audio', 'video')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['draft', 'active']): + raise ValueError("must be one of enum values ('draft', 'active')") + return value + + @field_validator('assignee_mode') + def assignee_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['everyone', 'selected']): + raise ValueError("must be one of enum values ('everyone', 'selected')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if due_date (nullable) is None + # and model_fields_set contains the field + if self.due_date is None and "due_date" in self.model_fields_set: + _dict['dueDate'] = None + + # set to None if scheduled_date (nullable) is None + # and model_fields_set contains the field + if self.scheduled_date is None and "scheduled_date" in self.model_fields_set: + _dict['scheduledDate'] = None + + # set to None if class_group_ids (nullable) is None + # and model_fields_set contains the field + if self.class_group_ids is None and "class_group_ids" in self.model_fields_set: + _dict['classGroupIds'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "description": obj.get("description"), + "descriptionHtml": obj.get("descriptionHtml"), + "teacherInstructions": obj.get("teacherInstructions"), + "teacherInstructionsHtml": obj.get("teacherInstructionsHtml"), + "attachments": [ClassAttachmentCreation.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "nbPlaybackAuthorized": obj.get("nbPlaybackAuthorized"), + "restrictPlayNote": obj.get("restrictPlayNote"), + "restrictToAudioTracks": obj.get("restrictToAudioTracks"), + "toolset": obj.get("toolset"), + "coverFile": obj.get("coverFile"), + "cover": obj.get("cover"), + "maxPoints": obj.get("maxPoints"), + "releaseGrades": obj.get("releaseGrades"), + "shuffleExercises": obj.get("shuffleExercises"), + "submissionStudentsMode": obj.get("submissionStudentsMode"), + "recordingType": obj.get("recordingType"), + "allowMetronome": obj.get("allowMetronome"), + "allowBackingTrack": obj.get("allowBackingTrack"), + "allowSpeedChange": obj.get("allowSpeedChange"), + "freeRecord": obj.get("freeRecord"), + "state": obj.get("state"), + "dueDate": obj.get("dueDate"), + "scheduledDate": obj.get("scheduledDate"), + "googleClassroom": ClassAssignmentUpdateAllOfGoogleClassroom.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "microsoftGraph": ClassAssignmentUpdateAllOfMicrosoftGraph.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "assigneeMode": obj.get("assigneeMode"), + "assignedStudents": obj.get("assignedStudents"), + "classGroupIds": obj.get("classGroupIds") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_update_all_of_google_classroom.py b/flat_api/models/class_assignment_update_all_of_google_classroom.py new file mode 100644 index 0000000..4fe44c7 --- /dev/null +++ b/flat_api/models/class_assignment_update_all_of_google_classroom.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdateAllOfGoogleClassroom(BaseModel): + """ + Google Classroom options for this assignment + """ # noqa: E501 + topic_id: Optional[StrictStr] = Field(default=None, description="Identifier of the topic where the assignment is created", alias="topicId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["topicId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if topic_id (nullable) is None + # and model_fields_set contains the field + if self.topic_id is None and "topic_id" in self.model_fields_set: + _dict['topicId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfGoogleClassroom from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "topicId": obj.get("topicId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_assignment_update_all_of_microsoft_graph.py b/flat_api/models/class_assignment_update_all_of_microsoft_graph.py new file mode 100644 index 0000000..7c6897d --- /dev/null +++ b/flat_api/models/class_assignment_update_all_of_microsoft_graph.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassAssignmentUpdateAllOfMicrosoftGraph(BaseModel): + """ + Microsoft Graph options for this assignment + """ # noqa: E501 + categories: Optional[List[StrictStr]] = Field(default=None, description="List of categories this assignment belongs to") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["categories"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAssignmentUpdateAllOfMicrosoftGraph from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "categories": obj.get("categories") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_attachment_creation.py b/flat_api/models/class_attachment_creation.py index e114d16..1b2413d 100644 --- a/flat_api/models/class_attachment_creation.py +++ b/flat_api/models/class_attachment_creation.py @@ -3,174 +3,129 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassAttachmentCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassAttachmentCreation(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'type': 'str', - 'score': 'str', - 'url': 'str' - } - - attribute_map = { - 'type': 'type', - 'score': 'score', - 'url': 'url' - } - - def __init__(self, type=None, score=None, url=None): # noqa: E501 - """ClassAttachmentCreation - a model defined in Swagger""" # noqa: E501 - - self._type = None - self._score = None - self._url = None - self.discriminator = None - - if type is not None: - self.type = type - if score is not None: - self.score = score - if url is not None: - self.url = url - - @property - def type(self): - """Gets the type of this ClassAttachmentCreation. # noqa: E501 - - The type of the attachment posted # noqa: E501 - - :return: The type of this ClassAttachmentCreation. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ClassAttachmentCreation. - - The type of the attachment posted # noqa: E501 - - :param type: The type of this ClassAttachmentCreation. # noqa: E501 - :type: str - """ - allowed_values = ["flat", "link", "exercise"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def score(self): - """Gets the score of this ClassAttachmentCreation. # noqa: E501 - - 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. # noqa: E501 - - :return: The score of this ClassAttachmentCreation. # noqa: E501 - :rtype: str - """ - return self._score - - @score.setter - def score(self, score): - """Sets the score of this ClassAttachmentCreation. - - 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. # noqa: E501 - - :param score: The score of this ClassAttachmentCreation. # noqa: E501 - :type: str + Attachment creation for an assignment or stream post. This attachment must contain a `score` or a `url`; its details are resolved and returned as a `MediaAttachment` once the assignment or stream post is created. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="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. ") + score: Optional[StrictStr] = Field(default=None, description="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. ") + worksheet: Optional[StrictStr] = Field(default=None, description="A unique worksheet identifier") + revision: Optional[StrictStr] = Field(default=None, description="A unique revision identifier of a score") + part_uuid: Optional[StrictStr] = Field(default=None, description="The UUID of the instrument part selected for this attachment (for performance submissions)", alias="partUuid") + sharing_mode: Optional[MediaScoreSharingMode] = Field(default=MediaScoreSharingMode.READ, alias="sharingMode") + lock_score_template: Optional[StrictBool] = Field(default=None, description="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.", alias="lockScoreTemplate") + url: Optional[StrictStr] = Field(default=None, description="The URL of the attachment.") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="The ID of the Google Drive File", alias="googleDriveFileId") + teacher_only: Optional[StrictBool] = Field(default=False, description="Flag indicating if this attachment should only be visible to teachers", alias="teacherOnly") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "score", "worksheet", "revision", "partUuid", "sharingMode", "lockScoreTemplate", "url", "googleDriveFileId", "teacherOnly"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet']): + raise ValueError("must be one of enum values ('rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassAttachmentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassAttachmentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "score": obj.get("score"), + "worksheet": obj.get("worksheet"), + "revision": obj.get("revision"), + "partUuid": obj.get("partUuid"), + "sharingMode": obj.get("sharingMode") if obj.get("sharingMode") is not None else MediaScoreSharingMode.READ, + "lockScoreTemplate": obj.get("lockScoreTemplate"), + "url": obj.get("url"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "teacherOnly": obj.get("teacherOnly") if obj.get("teacherOnly") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._score = score - - @property - def url(self): - """Gets the url of this ClassAttachmentCreation. # noqa: E501 - - The URL of the attachment. # noqa: E501 - - :return: The url of this ClassAttachmentCreation. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this ClassAttachmentCreation. - - The URL of the attachment. # noqa: E501 - - :param url: The url of this ClassAttachmentCreation. # noqa: E501 - :type: str - """ - self._url = url - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassAttachmentCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_creation.py b/flat_api/models/class_creation.py index 46863ff..cfda2c1 100644 --- a/flat_api/models/class_creation.py +++ b/flat_api/models/class_creation.py @@ -3,145 +3,126 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.class_grade_level import ClassGradeLevel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassCreation(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'str', - 'section': 'str' - } - - attribute_map = { - 'name': 'name', - 'section': 'section' - } - - def __init__(self, name=None, section=None): # noqa: E501 - """ClassCreation - a model defined in Swagger""" # noqa: E501 - - self._name = None - self._section = None - self.discriminator = None - - self.name = name - if section is not None: - self.section = section - - @property - def name(self): - """Gets the name of this ClassCreation. # noqa: E501 - - The name of the new class # noqa: E501 - - :return: The name of this ClassCreation. # noqa: E501 - :rtype: str + Creation of a classroom + """ # noqa: E501 + name: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The name of the new class") + section: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The section of the new class") + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "section", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this ClassCreation. - - The name of the new class # noqa: E501 - - :param name: The name of this ClassCreation. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - if name is not None and len(name) > 255: - raise ValueError("Invalid value for `name`, length must be less than or equal to `255`") # noqa: E501 - - self._name = name + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "section": obj.get("section"), + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @property - def section(self): - """Gets the section of this ClassCreation. # noqa: E501 - The section of the new class # noqa: E501 - - :return: The section of this ClassCreation. # noqa: E501 - :rtype: str - """ - return self._section - - @section.setter - def section(self, section): - """Sets the section of this ClassCreation. - - The section of the new class # noqa: E501 - - :param section: The section of this ClassCreation. # noqa: E501 - :type: str - """ - if section is not None and len(section) > 255: - raise ValueError("Invalid value for `section`, length must be less than or equal to `255`") # noqa: E501 - - self._section = section - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details.py b/flat_api/models/class_details.py index 6346be8..f6f80bf 100644 --- a/flat_api/models/class_details.py +++ b/flat_api/models/class_details.py @@ -3,580 +3,206 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_details_canvas import ClassDetailsCanvas # noqa: F401,E501 -from flat_api.models.class_details_clever import ClassDetailsClever # noqa: F401,E501 -from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom # noqa: F401,E501 -from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive # noqa: F401,E501 -from flat_api.models.class_details_lti import ClassDetailsLti # noqa: F401,E501 -from flat_api.models.class_state import ClassState # noqa: F401,E501 -from flat_api.models.group_details import GroupDetails # noqa: F401,E501 - - -class ClassDetails(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.class_details_canvas import ClassDetailsCanvas +from flat_api.models.class_details_clever import ClassDetailsClever +from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom +from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive +from flat_api.models.class_details_issues import ClassDetailsIssues +from flat_api.models.class_details_lti import ClassDetailsLti +from flat_api.models.class_details_mfc import ClassDetailsMfc +from flat_api.models.class_details_microsoft_graph import ClassDetailsMicrosoftGraph +from flat_api.models.class_grade_level import ClassGradeLevel +from flat_api.models.class_state import ClassState +from flat_api.models.group_details import GroupDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetails(BaseModel): """ - swagger_types = { - 'id': 'str', - 'state': 'ClassState', - 'name': 'str', - 'section': 'str', - 'description': 'str', - 'organization': 'str', - 'owner': 'str', - 'creation_date': 'datetime', - 'enrollment_code': 'str', - 'theme': 'str', - 'assignments_count': 'float', - 'students_group': 'GroupDetails', - 'teachers_group': 'GroupDetails', - 'google_classroom': 'ClassDetailsGoogleClassroom', - 'google_drive': 'ClassDetailsGoogleDrive', - 'lti': 'ClassDetailsLti', - 'canvas': 'ClassDetailsCanvas', - 'clever': 'ClassDetailsClever' - } - - attribute_map = { - 'id': 'id', - 'state': 'state', - 'name': 'name', - 'section': 'section', - 'description': 'description', - 'organization': 'organization', - 'owner': 'owner', - 'creation_date': 'creationDate', - 'enrollment_code': 'enrollmentCode', - 'theme': 'theme', - 'assignments_count': 'assignmentsCount', - 'students_group': 'studentsGroup', - 'teachers_group': 'teachersGroup', - 'google_classroom': 'googleClassroom', - 'google_drive': 'googleDrive', - 'lti': 'lti', - 'canvas': 'canvas', - 'clever': 'clever' - } - - def __init__(self, id=None, state=None, name=None, section=None, description=None, organization=None, owner=None, creation_date=None, enrollment_code=None, theme=None, assignments_count=None, students_group=None, teachers_group=None, google_classroom=None, google_drive=None, lti=None, canvas=None, clever=None): # noqa: E501 - """ClassDetails - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._state = None - self._name = None - self._section = None - self._description = None - self._organization = None - self._owner = None - self._creation_date = None - self._enrollment_code = None - self._theme = None - self._assignments_count = None - self._students_group = None - self._teachers_group = None - self._google_classroom = None - self._google_drive = None - self._lti = None - self._canvas = None - self._clever = None - self.discriminator = None - - if id is not None: - self.id = id - if state is not None: - self.state = state - if name is not None: - self.name = name - if section is not None: - self.section = section - if description is not None: - self.description = description - if organization is not None: - self.organization = organization - if owner is not None: - self.owner = owner - if creation_date is not None: - self.creation_date = creation_date - if enrollment_code is not None: - self.enrollment_code = enrollment_code - if theme is not None: - self.theme = theme - if assignments_count is not None: - self.assignments_count = assignments_count - if students_group is not None: - self.students_group = students_group - if teachers_group is not None: - self.teachers_group = teachers_group - if google_classroom is not None: - self.google_classroom = google_classroom - if google_drive is not None: - self.google_drive = google_drive - if lti is not None: - self.lti = lti - if canvas is not None: - self.canvas = canvas - if clever is not None: - self.clever = clever - - @property - def id(self): - """Gets the id of this ClassDetails. # noqa: E501 - - The unique identifier of the class # noqa: E501 - - :return: The id of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ClassDetails. - - The unique identifier of the class # noqa: E501 - - :param id: The id of this ClassDetails. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def state(self): - """Gets the state of this ClassDetails. # noqa: E501 - - - :return: The state of this ClassDetails. # noqa: E501 - :rtype: ClassState - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this ClassDetails. - - - :param state: The state of this ClassDetails. # noqa: E501 - :type: ClassState - """ - - self._state = state - - @property - def name(self): - """Gets the name of this ClassDetails. # noqa: E501 - - The name of the class # noqa: E501 - - :return: The name of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this ClassDetails. - - The name of the class # noqa: E501 - - :param name: The name of this ClassDetails. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def section(self): - """Gets the section of this ClassDetails. # noqa: E501 - - The section of the class # noqa: E501 - - :return: The section of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._section - - @section.setter - def section(self, section): - """Sets the section of this ClassDetails. - - The section of the class # noqa: E501 - - :param section: The section of this ClassDetails. # noqa: E501 - :type: str - """ - - self._section = section - - @property - def description(self): - """Gets the description of this ClassDetails. # noqa: E501 - - An optionnal description for this class # noqa: E501 - - :return: The description of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ClassDetails. - - An optionnal description for this class # noqa: E501 - - :param description: The description of this ClassDetails. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def organization(self): - """Gets the organization of this ClassDetails. # noqa: E501 - - The unique identifier of the Organization owning this class # noqa: E501 - - :return: The organization of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this ClassDetails. - - The unique identifier of the Organization owning this class # noqa: E501 - - :param organization: The organization of this ClassDetails. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def owner(self): - """Gets the owner of this ClassDetails. # noqa: E501 - - The unique identifier of the User owning this class # noqa: E501 - - :return: The owner of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._owner - - @owner.setter - def owner(self, owner): - """Sets the owner of this ClassDetails. - - The unique identifier of the User owning this class # noqa: E501 - - :param owner: The owner of this ClassDetails. # noqa: E501 - :type: str - """ - - self._owner = owner - - @property - def creation_date(self): - """Gets the creation_date of this ClassDetails. # noqa: E501 - - The date when the class was create # noqa: E501 - - :return: The creation_date of this ClassDetails. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this ClassDetails. - - The date when the class was create # noqa: E501 - - :param creation_date: The creation_date of this ClassDetails. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def enrollment_code(self): - """Gets the enrollment_code of this ClassDetails. # noqa: E501 - - [Teachers only] The enrollment code that can be used by the students to join the class # noqa: E501 - - :return: The enrollment_code of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._enrollment_code - - @enrollment_code.setter - def enrollment_code(self, enrollment_code): - """Sets the enrollment_code of this ClassDetails. - - [Teachers only] The enrollment code that can be used by the students to join the class # noqa: E501 - - :param enrollment_code: The enrollment_code of this ClassDetails. # noqa: E501 - :type: str - """ - - self._enrollment_code = enrollment_code - - @property - def theme(self): - """Gets the theme of this ClassDetails. # noqa: E501 - - The theme identifier using in Flat User Interface # noqa: E501 - - :return: The theme of this ClassDetails. # noqa: E501 - :rtype: str - """ - return self._theme - - @theme.setter - def theme(self, theme): - """Sets the theme of this ClassDetails. - - The theme identifier using in Flat User Interface # noqa: E501 - - :param theme: The theme of this ClassDetails. # noqa: E501 - :type: str - """ - - self._theme = theme - - @property - def assignments_count(self): - """Gets the assignments_count of this ClassDetails. # noqa: E501 - - The number of assignments created in the class # noqa: E501 - - :return: The assignments_count of this ClassDetails. # noqa: E501 - :rtype: float - """ - return self._assignments_count - - @assignments_count.setter - def assignments_count(self, assignments_count): - """Sets the assignments_count of this ClassDetails. - - The number of assignments created in the class # noqa: E501 - - :param assignments_count: The assignments_count of this ClassDetails. # noqa: E501 - :type: float - """ - - self._assignments_count = assignments_count - - @property - def students_group(self): - """Gets the students_group of this ClassDetails. # noqa: E501 - - - :return: The students_group of this ClassDetails. # noqa: E501 - :rtype: GroupDetails - """ - return self._students_group - - @students_group.setter - def students_group(self, students_group): - """Sets the students_group of this ClassDetails. - - - :param students_group: The students_group of this ClassDetails. # noqa: E501 - :type: GroupDetails - """ - - self._students_group = students_group - - @property - def teachers_group(self): - """Gets the teachers_group of this ClassDetails. # noqa: E501 - - - :return: The teachers_group of this ClassDetails. # noqa: E501 - :rtype: GroupDetails - """ - return self._teachers_group - - @teachers_group.setter - def teachers_group(self, teachers_group): - """Sets the teachers_group of this ClassDetails. - - - :param teachers_group: The teachers_group of this ClassDetails. # noqa: E501 - :type: GroupDetails - """ - - self._teachers_group = teachers_group - - @property - def google_classroom(self): - """Gets the google_classroom of this ClassDetails. # noqa: E501 - - - :return: The google_classroom of this ClassDetails. # noqa: E501 - :rtype: ClassDetailsGoogleClassroom - """ - return self._google_classroom - - @google_classroom.setter - def google_classroom(self, google_classroom): - """Sets the google_classroom of this ClassDetails. - - - :param google_classroom: The google_classroom of this ClassDetails. # noqa: E501 - :type: ClassDetailsGoogleClassroom - """ - - self._google_classroom = google_classroom - - @property - def google_drive(self): - """Gets the google_drive of this ClassDetails. # noqa: E501 - - - :return: The google_drive of this ClassDetails. # noqa: E501 - :rtype: ClassDetailsGoogleDrive - """ - return self._google_drive - - @google_drive.setter - def google_drive(self, google_drive): - """Sets the google_drive of this ClassDetails. - - - :param google_drive: The google_drive of this ClassDetails. # noqa: E501 - :type: ClassDetailsGoogleDrive - """ - - self._google_drive = google_drive - - @property - def lti(self): - """Gets the lti of this ClassDetails. # noqa: E501 - - - :return: The lti of this ClassDetails. # noqa: E501 - :rtype: ClassDetailsLti - """ - return self._lti - - @lti.setter - def lti(self, lti): - """Sets the lti of this ClassDetails. - - - :param lti: The lti of this ClassDetails. # noqa: E501 - :type: ClassDetailsLti - """ - - self._lti = lti - - @property - def canvas(self): - """Gets the canvas of this ClassDetails. # noqa: E501 - - - :return: The canvas of this ClassDetails. # noqa: E501 - :rtype: ClassDetailsCanvas - """ - return self._canvas - - @canvas.setter - def canvas(self, canvas): - """Sets the canvas of this ClassDetails. - - - :param canvas: The canvas of this ClassDetails. # noqa: E501 - :type: ClassDetailsCanvas - """ - - self._canvas = canvas - - @property - def clever(self): - """Gets the clever of this ClassDetails. # noqa: E501 - - - :return: The clever of this ClassDetails. # noqa: E501 - :rtype: ClassDetailsClever - """ - return self._clever - - @clever.setter - def clever(self, clever): - """Sets the clever of this ClassDetails. - - - :param clever: The clever of this ClassDetails. # noqa: E501 - :type: ClassDetailsClever - """ - - self._clever = clever - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetails): - return False + A classroom + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the class") + state: ClassState + name: StrictStr = Field(description="The name of the class") + section: Optional[StrictStr] = Field(default=None, description="The section of the class") + description: Optional[StrictStr] = Field(default=None, description="An optional description for this class") + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization owning this class") + owner: Optional[StrictStr] = Field(default=None, description="The unique identifier of the User owning this class") + creation_date: datetime = Field(description="The date when the class was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date when the class was last modified", alias="modificationDate") + enrollment_code: Optional[StrictStr] = Field(default=None, description="[Teachers only] The enrollment code that can be used by the students to join the class ", alias="enrollmentCode") + theme: Optional[StrictStr] = Field(default=None, description="The theme identifier used in the Flat user interface") + assignments_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of assignments created in the class", alias="assignmentsCount") + students_group: Optional[GroupDetails] = Field(default=None, alias="studentsGroup") + teachers_group: Optional[GroupDetails] = Field(default=None, alias="teachersGroup") + issues: Optional[ClassDetailsIssues] = None + google_classroom: Optional[ClassDetailsGoogleClassroom] = Field(default=None, alias="googleClassroom") + google_drive: Optional[ClassDetailsGoogleDrive] = Field(default=None, alias="googleDrive") + microsoft_graph: Optional[ClassDetailsMicrosoftGraph] = Field(default=None, alias="microsoftGraph") + lti: Optional[ClassDetailsLti] = None + canvas: Optional[ClassDetailsCanvas] = None + mfc: Optional[ClassDetailsMfc] = None + clever: Optional[ClassDetailsClever] = None + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "name", "section", "description", "organization", "owner", "creationDate", "modificationDate", "enrollmentCode", "theme", "assignmentsCount", "studentsGroup", "teachersGroup", "issues", "googleClassroom", "googleDrive", "microsoftGraph", "lti", "canvas", "mfc", "clever", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of students_group + if self.students_group: + _dict['studentsGroup'] = self.students_group.to_dict() + # override the default output from pydantic by calling `to_dict()` of teachers_group + if self.teachers_group: + _dict['teachersGroup'] = self.teachers_group.to_dict() + # override the default output from pydantic by calling `to_dict()` of issues + if self.issues: + _dict['issues'] = self.issues.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_classroom + if self.google_classroom: + _dict['googleClassroom'] = self.google_classroom.to_dict() + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + # override the default output from pydantic by calling `to_dict()` of microsoft_graph + if self.microsoft_graph: + _dict['microsoftGraph'] = self.microsoft_graph.to_dict() + # override the default output from pydantic by calling `to_dict()` of lti + if self.lti: + _dict['lti'] = self.lti.to_dict() + # override the default output from pydantic by calling `to_dict()` of canvas + if self.canvas: + _dict['canvas'] = self.canvas.to_dict() + # override the default output from pydantic by calling `to_dict()` of mfc + if self.mfc: + _dict['mfc'] = self.mfc.to_dict() + # override the default output from pydantic by calling `to_dict()` of clever + if self.clever: + _dict['clever'] = self.clever.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "name": obj.get("name"), + "section": obj.get("section"), + "description": obj.get("description"), + "organization": obj.get("organization"), + "owner": obj.get("owner"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "enrollmentCode": obj.get("enrollmentCode"), + "theme": obj.get("theme"), + "assignmentsCount": obj.get("assignmentsCount"), + "studentsGroup": GroupDetails.from_dict(obj["studentsGroup"]) if obj.get("studentsGroup") is not None else None, + "teachersGroup": GroupDetails.from_dict(obj["teachersGroup"]) if obj.get("teachersGroup") is not None else None, + "issues": ClassDetailsIssues.from_dict(obj["issues"]) if obj.get("issues") is not None else None, + "googleClassroom": ClassDetailsGoogleClassroom.from_dict(obj["googleClassroom"]) if obj.get("googleClassroom") is not None else None, + "googleDrive": ClassDetailsGoogleDrive.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "microsoftGraph": ClassDetailsMicrosoftGraph.from_dict(obj["microsoftGraph"]) if obj.get("microsoftGraph") is not None else None, + "lti": ClassDetailsLti.from_dict(obj["lti"]) if obj.get("lti") is not None else None, + "canvas": ClassDetailsCanvas.from_dict(obj["canvas"]) if obj.get("canvas") is not None else None, + "mfc": ClassDetailsMfc.from_dict(obj["mfc"]) if obj.get("mfc") is not None else None, + "clever": ClassDetailsClever.from_dict(obj["clever"]) if obj.get("clever") is not None else None, + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_canvas.py b/flat_api/models/class_details_canvas.py index 8833536..7f218f3 100644 --- a/flat_api/models/class_details_canvas.py +++ b/flat_api/models/class_details_canvas.py @@ -3,140 +3,102 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassDetailsCanvas(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassDetailsCanvas(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'domain': 'str' - } - - attribute_map = { - 'id': 'id', - 'domain': 'domain' - } - - def __init__(self, id=None, domain=None): # noqa: E501 - """ClassDetailsCanvas - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._domain = None - self.discriminator = None - - if id is not None: - self.id = id - if domain is not None: - self.domain = domain - - @property - def id(self): - """Gets the id of this ClassDetailsCanvas. # noqa: E501 - - Unique identifier of the course on Canvas # noqa: E501 - - :return: The id of this ClassDetailsCanvas. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ClassDetailsCanvas. - - Unique identifier of the course on Canvas # noqa: E501 - - :param id: The id of this ClassDetailsCanvas. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def domain(self): - """Gets the domain of this ClassDetailsCanvas. # noqa: E501 - - Canvas instance domain (e.g. \"canvas.instructure.com\") # noqa: E501 - - :return: The domain of this ClassDetailsCanvas. # noqa: E501 - :rtype: str + Meta information provided by Canvas LMS + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the course on Canvas") + domain: Optional[StrictStr] = Field(default=None, description="Canvas instance domain (e.g. \"canvas.instructure.com\")") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "domain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsCanvas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._domain + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsCanvas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "domain": obj.get("domain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @domain.setter - def domain(self, domain): - """Sets the domain of this ClassDetailsCanvas. - - Canvas instance domain (e.g. \"canvas.instructure.com\") # noqa: E501 - - :param domain: The domain of this ClassDetailsCanvas. # noqa: E501 - :type: str - """ - self._domain = domain - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetailsCanvas): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_clever.py b/flat_api/models/class_details_clever.py index e51c05b..23a8d78 100644 --- a/flat_api/models/class_details_clever.py +++ b/flat_api/models/class_details_clever.py @@ -3,286 +3,123 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class ClassDetailsClever(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class ClassDetailsClever(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'creation_date': 'datetime', - 'modification_date': 'datetime', - 'subject': 'str', - 'term_name': 'str', - 'term_start_date': 'datetime', - 'term_end_date': 'datetime' - } - - attribute_map = { - 'id': 'id', - 'creation_date': 'creationDate', - 'modification_date': 'modificationDate', - 'subject': 'subject', - 'term_name': 'termName', - 'term_start_date': 'termStartDate', - 'term_end_date': 'termEndDate' - } - - def __init__(self, id=None, creation_date=None, modification_date=None, subject=None, term_name=None, term_start_date=None, term_end_date=None): # noqa: E501 - """ClassDetailsClever - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._creation_date = None - self._modification_date = None - self._subject = None - self._term_name = None - self._term_start_date = None - self._term_end_date = None - self.discriminator = None - - if id is not None: - self.id = id - if creation_date is not None: - self.creation_date = creation_date - if modification_date is not None: - self.modification_date = modification_date - if subject is not None: - self.subject = subject - if term_name is not None: - self.term_name = term_name - if term_start_date is not None: - self.term_start_date = term_start_date - if term_end_date is not None: - self.term_end_date = term_end_date - - @property - def id(self): - """Gets the id of this ClassDetailsClever. # noqa: E501 - - Clever section unique identifier # noqa: E501 - - :return: The id of this ClassDetailsClever. # noqa: E501 - :rtype: str + Clever.com section-related information + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Clever section unique identifier") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the section on clever", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The last modification date of the section on clever", alias="modificationDate") + subject: Optional[StrictStr] = Field(default=None, description="Normalized subject of the course") + term_name: Optional[StrictStr] = Field(default=None, description="Name of the term when this course happens", alias="termName") + term_start_date: Optional[datetime] = Field(default=None, description="Beginning date of the term", alias="termStartDate") + term_end_date: Optional[datetime] = Field(default=None, description="End date of the term", alias="termEndDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creationDate", "modificationDate", "subject", "termName", "termStartDate", "termEndDate"] + + @field_validator('subject') + def subject_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['english/language arts', 'math', 'science', 'social studies', 'language', 'homeroom/advisory', 'interventions/online learning', 'technology and engineering', 'PE and health', 'arts and music', 'other']): + raise ValueError("must be one of enum values ('english/language arts', 'math', 'science', 'social studies', 'language', 'homeroom/advisory', 'interventions/online learning', 'technology and engineering', 'PE and health', 'arts and music', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsClever from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ClassDetailsClever. - - Clever section unique identifier # noqa: E501 - - :param id: The id of this ClassDetailsClever. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def creation_date(self): - """Gets the creation_date of this ClassDetailsClever. # noqa: E501 - - The creation date of the section on clever # noqa: E501 - - :return: The creation_date of this ClassDetailsClever. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this ClassDetailsClever. - - The creation date of the section on clever # noqa: E501 - - :param creation_date: The creation_date of this ClassDetailsClever. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def modification_date(self): - """Gets the modification_date of this ClassDetailsClever. # noqa: E501 - - The last modification date of the section on clever # noqa: E501 - - :return: The modification_date of this ClassDetailsClever. # noqa: E501 - :rtype: datetime - """ - return self._modification_date - - @modification_date.setter - def modification_date(self, modification_date): - """Sets the modification_date of this ClassDetailsClever. - - The last modification date of the section on clever # noqa: E501 - - :param modification_date: The modification_date of this ClassDetailsClever. # noqa: E501 - :type: datetime - """ - - self._modification_date = modification_date - - @property - def subject(self): - """Gets the subject of this ClassDetailsClever. # noqa: E501 - - Normalized subject of the course # noqa: E501 - - :return: The subject of this ClassDetailsClever. # noqa: E501 - :rtype: str - """ - return self._subject - - @subject.setter - def subject(self, subject): - """Sets the subject of this ClassDetailsClever. - - Normalized subject of the course # noqa: E501 - - :param subject: The subject of this ClassDetailsClever. # noqa: E501 - :type: str - """ - allowed_values = ["english/language arts", "math", "science", "social studies", "language", "homeroom/advisory", "interventions/online learning", "technology and engineering", "PE and health", "arts and music", "other"] # noqa: E501 - if subject not in allowed_values: - raise ValueError( - "Invalid value for `subject` ({0}), must be one of {1}" # noqa: E501 - .format(subject, allowed_values) - ) - - self._subject = subject - - @property - def term_name(self): - """Gets the term_name of this ClassDetailsClever. # noqa: E501 - - Name of the term when this course happens # noqa: E501 - - :return: The term_name of this ClassDetailsClever. # noqa: E501 - :rtype: str - """ - return self._term_name - - @term_name.setter - def term_name(self, term_name): - """Sets the term_name of this ClassDetailsClever. - - Name of the term when this course happens # noqa: E501 - - :param term_name: The term_name of this ClassDetailsClever. # noqa: E501 - :type: str - """ - - self._term_name = term_name - - @property - def term_start_date(self): - """Gets the term_start_date of this ClassDetailsClever. # noqa: E501 - - Beginning date of the term # noqa: E501 - - :return: The term_start_date of this ClassDetailsClever. # noqa: E501 - :rtype: datetime - """ - return self._term_start_date - - @term_start_date.setter - def term_start_date(self, term_start_date): - """Sets the term_start_date of this ClassDetailsClever. - - Beginning date of the term # noqa: E501 - - :param term_start_date: The term_start_date of this ClassDetailsClever. # noqa: E501 - :type: datetime - """ - - self._term_start_date = term_start_date - - @property - def term_end_date(self): - """Gets the term_end_date of this ClassDetailsClever. # noqa: E501 - - End date of the term # noqa: E501 - - :return: The term_end_date of this ClassDetailsClever. # noqa: E501 - :rtype: datetime - """ - return self._term_end_date - - @term_end_date.setter - def term_end_date(self, term_end_date): - """Sets the term_end_date of this ClassDetailsClever. - - End date of the term # noqa: E501 - - :param term_end_date: The term_end_date of this ClassDetailsClever. # noqa: E501 - :type: datetime - """ - - self._term_end_date = term_end_date - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetailsClever): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsClever from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "subject": obj.get("subject"), + "termName": obj.get("termName"), + "termStartDate": obj.get("termStartDate"), + "termEndDate": obj.get("termEndDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_google_classroom.py b/flat_api/models/class_details_google_classroom.py index a733375..2f0921a 100644 --- a/flat_api/models/class_details_google_classroom.py +++ b/flat_api/models/class_details_google_classroom.py @@ -3,196 +3,102 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassDetailsGoogleClassroom(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassDetailsGoogleClassroom(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'alternate_link': 'str', - 'name': 'str', - 'section': 'str' - } - - attribute_map = { - 'id': 'id', - 'alternate_link': 'alternateLink', - 'name': 'name', - 'section': 'section' - } - - def __init__(self, id=None, alternate_link=None, name=None, section=None): # noqa: E501 - """ClassDetailsGoogleClassroom - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._alternate_link = None - self._name = None - self._section = None - self.discriminator = None - - if id is not None: - self.id = id - if alternate_link is not None: - self.alternate_link = alternate_link - if name is not None: - self.name = name - if section is not None: - self.section = section - - @property - def id(self): - """Gets the id of this ClassDetailsGoogleClassroom. # noqa: E501 - - The course identifier on Google Classroom # noqa: E501 - - :return: The id of this ClassDetailsGoogleClassroom. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ClassDetailsGoogleClassroom. - - The course identifier on Google Classroom # noqa: E501 - - :param id: The id of this ClassDetailsGoogleClassroom. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def alternate_link(self): - """Gets the alternate_link of this ClassDetailsGoogleClassroom. # noqa: E501 - - Absolute link to this course in the Classroom web UI # noqa: E501 - - :return: The alternate_link of this ClassDetailsGoogleClassroom. # noqa: E501 - :rtype: str + Google Classroom course-related information + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The course identifier on Google Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this course in the Classroom web UI", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleClassroom from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._alternate_link - - @alternate_link.setter - def alternate_link(self, alternate_link): - """Sets the alternate_link of this ClassDetailsGoogleClassroom. - - Absolute link to this course in the Classroom web UI # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleClassroom from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param alternate_link: The alternate_link of this ClassDetailsGoogleClassroom. # noqa: E501 - :type: str - """ - - self._alternate_link = alternate_link - - @property - def name(self): - """Gets the name of this ClassDetailsGoogleClassroom. # noqa: E501 - - The name of the course on Google Classroom # noqa: E501 - - :return: The name of this ClassDetailsGoogleClassroom. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this ClassDetailsGoogleClassroom. - - The name of the course on Google Classroom # noqa: E501 - - :param name: The name of this ClassDetailsGoogleClassroom. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def section(self): - """Gets the section of this ClassDetailsGoogleClassroom. # noqa: E501 - - The section of the course on Google Classroom # noqa: E501 - - :return: The section of this ClassDetailsGoogleClassroom. # noqa: E501 - :rtype: str - """ - return self._section - - @section.setter - def section(self, section): - """Sets the section of this ClassDetailsGoogleClassroom. - - The section of the course on Google Classroom # noqa: E501 - - :param section: The section of this ClassDetailsGoogleClassroom. # noqa: E501 - :type: str - """ - self._section = section - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetailsGoogleClassroom): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_google_drive.py b/flat_api/models/class_details_google_drive.py index 2a8bb94..06024f7 100644 --- a/flat_api/models/class_details_google_drive.py +++ b/flat_api/models/class_details_google_drive.py @@ -3,140 +3,102 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassDetailsGoogleDrive(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassDetailsGoogleDrive(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'teacher_folder_id': 'str', - 'teacher_folder_alternate_link': 'str' - } - - attribute_map = { - 'teacher_folder_id': 'teacherFolderId', - 'teacher_folder_alternate_link': 'teacherFolderAlternateLink' - } - - def __init__(self, teacher_folder_id=None, teacher_folder_alternate_link=None): # noqa: E501 - """ClassDetailsGoogleDrive - a model defined in Swagger""" # noqa: E501 - - self._teacher_folder_id = None - self._teacher_folder_alternate_link = None - self.discriminator = None - - if teacher_folder_id is not None: - self.teacher_folder_id = teacher_folder_id - if teacher_folder_alternate_link is not None: - self.teacher_folder_alternate_link = teacher_folder_alternate_link - - @property - def teacher_folder_id(self): - """Gets the teacher_folder_id of this ClassDetailsGoogleDrive. # noqa: E501 - - [Teachers only] The Drive directory identifier of the teachers' folder # noqa: E501 - - :return: The teacher_folder_id of this ClassDetailsGoogleDrive. # noqa: E501 - :rtype: str - """ - return self._teacher_folder_id - - @teacher_folder_id.setter - def teacher_folder_id(self, teacher_folder_id): - """Sets the teacher_folder_id of this ClassDetailsGoogleDrive. - - [Teachers only] The Drive directory identifier of the teachers' folder # noqa: E501 - - :param teacher_folder_id: The teacher_folder_id of this ClassDetailsGoogleDrive. # noqa: E501 - :type: str - """ - - self._teacher_folder_id = teacher_folder_id - - @property - def teacher_folder_alternate_link(self): - """Gets the teacher_folder_alternate_link of this ClassDetailsGoogleDrive. # noqa: E501 - - [Teachers only] The Drive URL of the teachers' folder # noqa: E501 - - :return: The teacher_folder_alternate_link of this ClassDetailsGoogleDrive. # noqa: E501 - :rtype: str + Google Drive course-related information provided by Google Classroom + """ # noqa: E501 + teacher_folder_id: Optional[StrictStr] = Field(default=None, description="[Teachers only] The Drive directory identifier of the teachers' folder ", alias="teacherFolderId") + teacher_folder_alternate_link: Optional[StrictStr] = Field(default=None, description="[Teachers only] The Drive URL of the teachers' folder ", alias="teacherFolderAlternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["teacherFolderId", "teacherFolderAlternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleDrive from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._teacher_folder_alternate_link + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsGoogleDrive from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "teacherFolderId": obj.get("teacherFolderId"), + "teacherFolderAlternateLink": obj.get("teacherFolderAlternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @teacher_folder_alternate_link.setter - def teacher_folder_alternate_link(self, teacher_folder_alternate_link): - """Sets the teacher_folder_alternate_link of this ClassDetailsGoogleDrive. - - [Teachers only] The Drive URL of the teachers' folder # noqa: E501 - - :param teacher_folder_alternate_link: The teacher_folder_alternate_link of this ClassDetailsGoogleDrive. # noqa: E501 - :type: str - """ - self._teacher_folder_alternate_link = teacher_folder_alternate_link - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetailsGoogleDrive): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_issues.py b/flat_api/models/class_details_issues.py new file mode 100644 index 0000000..b929d31 --- /dev/null +++ b/flat_api/models/class_details_issues.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.class_details_issues_sync_inner import ClassDetailsIssuesSyncInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsIssues(BaseModel): + """ + Detected issues for this class + """ # noqa: E501 + sync: Optional[List[ClassDetailsIssuesSyncInner]] = Field(default=None, description="Synchronization issues for the class") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sync"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsIssues from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sync (list) + _items = [] + if self.sync: + for _item_sync in self.sync: + if _item_sync: + _items.append(_item_sync.to_dict()) + _dict['sync'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsIssues from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sync": [ClassDetailsIssuesSyncInner.from_dict(_item) for _item in obj["sync"]] if obj.get("sync") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_details_issues_sync_inner.py b/flat_api/models/class_details_issues_sync_inner.py new file mode 100644 index 0000000..b311472 --- /dev/null +++ b/flat_api/models/class_details_issues_sync_inner.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsIssuesSyncInner(BaseModel): + """ + A sync issue + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The account user identifier") + email: Optional[StrictStr] = Field(default=None, description="The email address of the user concerned by this sync issue") + reason: Optional[StrictStr] = Field(default=None, description="The reason why the account cannot be synced") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "email", "reason"] + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['otherOrgnanization', 'productMigration', 'disabledAccount']): + raise ValueError("must be one of enum values ('otherOrgnanization', 'productMigration', 'disabledAccount')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsIssuesSyncInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsIssuesSyncInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "email": obj.get("email"), + "reason": obj.get("reason") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_details_lti.py b/flat_api/models/class_details_lti.py index bc78eb6..cbd3ff3 100644 --- a/flat_api/models/class_details_lti.py +++ b/flat_api/models/class_details_lti.py @@ -3,168 +3,106 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassDetailsLti(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassDetailsLti(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'context_id': 'str', - 'context_title': 'str', - 'context_label': 'str' - } - - attribute_map = { - 'context_id': 'contextId', - 'context_title': 'contextTitle', - 'context_label': 'contextLabel' - } - - def __init__(self, context_id=None, context_title=None, context_label=None): # noqa: E501 - """ClassDetailsLti - a model defined in Swagger""" # noqa: E501 - - self._context_id = None - self._context_title = None - self._context_label = None - self.discriminator = None - - if context_id is not None: - self.context_id = context_id - if context_title is not None: - self.context_title = context_title - if context_label is not None: - self.context_label = context_label - - @property - def context_id(self): - """Gets the context_id of this ClassDetailsLti. # noqa: E501 - - Unique context identifier provided # noqa: E501 - - :return: The context_id of this ClassDetailsLti. # noqa: E501 - :rtype: str - """ - return self._context_id - - @context_id.setter - def context_id(self, context_id): - """Sets the context_id of this ClassDetailsLti. - - Unique context identifier provided # noqa: E501 - - :param context_id: The context_id of this ClassDetailsLti. # noqa: E501 - :type: str - """ - - self._context_id = context_id - - @property - def context_title(self): - """Gets the context_title of this ClassDetailsLti. # noqa: E501 - - Context title # noqa: E501 - - :return: The context_title of this ClassDetailsLti. # noqa: E501 - :rtype: str - """ - return self._context_title - - @context_title.setter - def context_title(self, context_title): - """Sets the context_title of this ClassDetailsLti. - - Context title # noqa: E501 - - :param context_title: The context_title of this ClassDetailsLti. # noqa: E501 - :type: str + Info about LTI context (1.1 and 1.3) + """ # noqa: E501 + context_id: Optional[StrictStr] = Field(default=None, description="Unique context identifier provided", alias="contextId") + context_title: Optional[StrictStr] = Field(default=None, description="Context title", alias="contextTitle") + context_label: Optional[StrictStr] = Field(default=None, description="Context label", alias="contextLabel") + has_nrps_service: Optional[StrictBool] = Field(default=None, description="If true, the class has been synchronized with the LTI 1.3 NRPS 2.0 service", alias="hasNrpsService") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["contextId", "contextTitle", "contextLabel", "hasNrpsService"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsLti from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsLti from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "contextId": obj.get("contextId"), + "contextTitle": obj.get("contextTitle"), + "contextLabel": obj.get("contextLabel"), + "hasNrpsService": obj.get("hasNrpsService") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._context_title = context_title - - @property - def context_label(self): - """Gets the context_label of this ClassDetailsLti. # noqa: E501 - - Context label # noqa: E501 - - :return: The context_label of this ClassDetailsLti. # noqa: E501 - :rtype: str - """ - return self._context_label - - @context_label.setter - def context_label(self, context_label): - """Sets the context_label of this ClassDetailsLti. - - Context label # noqa: E501 - - :param context_label: The context_label of this ClassDetailsLti. # noqa: E501 - :type: str - """ - self._context_label = context_label - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassDetailsLti): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_details_mfc.py b/flat_api/models/class_details_mfc.py new file mode 100644 index 0000000..4d00904 --- /dev/null +++ b/flat_api/models/class_details_mfc.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsMfc(BaseModel): + """ + Meta information provided by MusicFirst Classroom + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the course on MusicFirst Classroom") + alternate_link: Optional[StrictStr] = Field(default=None, description="Link to MusicFirst Classroom class", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsMfc from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsMfc from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_details_microsoft_graph.py b/flat_api/models/class_details_microsoft_graph.py new file mode 100644 index 0000000..637d56d --- /dev/null +++ b/flat_api/models/class_details_microsoft_graph.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ClassDetailsMicrosoftGraph(BaseModel): + """ + ClassDetailsMicrosoftGraph + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The course identifier on Microsoft Graph") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassDetailsMicrosoftGraph from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassDetailsMicrosoftGraph from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/class_grade_level.py b/flat_api/models/class_grade_level.py new file mode 100644 index 0000000..093b5c8 --- /dev/null +++ b/flat_api/models/class_grade_level.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ClassGradeLevel(str, Enum): + """ + Class grade level + """ + + """ + allowed enum values + """ + ELEMENTARY = 'elementary' + MIDDLE = 'middle' + HIGH = 'high' + UNIVERSITY = 'university' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassGradeLevel from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/class_roles.py b/flat_api/models/class_roles.py index 566fac9..e13d741 100644 --- a/flat_api/models/class_roles.py +++ b/flat_api/models/class_roles.py @@ -3,88 +3,36 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ClassRoles(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ClassRoles(str, Enum): """ - allowed enum values + User's Class Role (for Edu users only) """ - TEACHER = "teacher" - STUDENT = "student" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ClassRoles - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + TEACHER = 'teacher' + STUDENT = 'student' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassRoles): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassRoles from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_state.py b/flat_api/models/class_state.py index 8209d1f..a7c3ed5 100644 --- a/flat_api/models/class_state.py +++ b/flat_api/models/class_state.py @@ -3,89 +3,38 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ClassState(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ClassState(str, Enum): """ - allowed enum values + The state of a classroom """ - ACTIVE = "active" - INACTIVE = "inactive" - ARCHIVED = "archived" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ClassState - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + ACTIVE = 'active' + INACTIVE = 'inactive' + ARCHIVED = 'archived' + DELETED = 'deleted' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassState): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ClassState from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/class_update.py b/flat_api/models/class_update.py index 83d45b9..9a03aca 100644 --- a/flat_api/models/class_update.py +++ b/flat_api/models/class_update.py @@ -3,144 +3,126 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ClassUpdate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.class_grade_level import ClassGradeLevel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ClassUpdate(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'str', - 'section': 'str' - } - - attribute_map = { - 'name': 'name', - 'section': 'section' - } - - def __init__(self, name=None, section=None): # noqa: E501 - """ClassUpdate - a model defined in Swagger""" # noqa: E501 - - self._name = None - self._section = None - self.discriminator = None - - if name is not None: - self.name = name - if section is not None: - self.section = section - - @property - def name(self): - """Gets the name of this ClassUpdate. # noqa: E501 - - The name of the class # noqa: E501 - - :return: The name of this ClassUpdate. # noqa: E501 - :rtype: str + Update of a classroom + """ # noqa: E501 + name: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The name of the class") + section: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="The section of the class") + level: Optional[ClassGradeLevel] = None + skills_focused: Optional[List[StrictStr]] = Field(default=None, description="Specific skills that will be focused in classroom", alias="skillsFocused") + size: Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Number of students in the classroom") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "section", "level", "skillsFocused", "size"] + + @field_validator('skills_focused') + def skills_focused_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other']): + raise ValueError("each list item must be one of ('notation', 'sight-reading', 'performance-instrumental', 'ear-training', 'music-theory', 'composition', 'jazz-ensemble', 'music-technology', 'other')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClassUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this ClassUpdate. - - The name of the class # noqa: E501 - - :param name: The name of this ClassUpdate. # noqa: E501 - :type: str - """ - if name is not None and len(name) > 255: - raise ValueError("Invalid value for `name`, length must be less than or equal to `255`") # noqa: E501 - - self._name = name + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if size (nullable) is None + # and model_fields_set contains the field + if self.size is None and "size" in self.model_fields_set: + _dict['size'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClassUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "section": obj.get("section"), + "level": obj.get("level"), + "skillsFocused": obj.get("skillsFocused"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @property - def section(self): - """Gets the section of this ClassUpdate. # noqa: E501 - The section of the class # noqa: E501 - - :return: The section of this ClassUpdate. # noqa: E501 - :rtype: str - """ - return self._section - - @section.setter - def section(self, section): - """Sets the section of this ClassUpdate. - - The section of the class # noqa: E501 - - :param section: The section of this ClassUpdate. # noqa: E501 - :type: str - """ - if section is not None and len(section) > 255: - raise ValueError("Invalid value for `section`, length must be less than or equal to `255`") # noqa: E501 - - self._section = section - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ClassUpdate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection.py b/flat_api/models/collection.py index dfc83fa..50af6b1 100644 --- a/flat_api/models/collection.py +++ b/flat_api/models/collection.py @@ -3,388 +3,165 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.collection_capabilities import CollectionCapabilities # noqa: F401,E501 -from flat_api.models.collection_privacy import CollectionPrivacy # noqa: F401,E501 -from flat_api.models.collection_title import CollectionTitle # noqa: F401,E501 -from flat_api.models.collection_type import CollectionType # noqa: F401,E501 -from flat_api.models.resource_collaborator import ResourceCollaborator # noqa: F401,E501 -from flat_api.models.resource_rights import ResourceRights # noqa: F401,E501 -from flat_api.models.user_public_summary import UserPublicSummary # noqa: F401,E501 - - -class Collection(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.collection_app import CollectionApp +from flat_api.models.collection_capabilities import CollectionCapabilities +from flat_api.models.collection_contents import CollectionContents +from flat_api.models.collection_privacy import CollectionPrivacy +from flat_api.models.collection_type import CollectionType +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.models.resource_rights import ResourceRights +from flat_api.models.user_public_summary import UserPublicSummary +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Collection(BaseModel): """ - swagger_types = { - 'id': 'str', - 'title': 'CollectionTitle', - 'html_url': 'str', - 'type': 'CollectionType', - 'privacy': 'CollectionPrivacy', - 'sharing_key': 'str', - 'app': 'str', - 'user': 'UserPublicSummary', - 'rights': 'ResourceRights', - 'collaborators': 'list[ResourceCollaborator]', - 'capabilities': 'CollectionCapabilities' - } - - attribute_map = { - 'id': 'id', - 'title': 'title', - 'html_url': 'htmlUrl', - 'type': 'type', - 'privacy': 'privacy', - 'sharing_key': 'sharingKey', - 'app': 'app', - 'user': 'user', - 'rights': 'rights', - 'collaborators': 'collaborators', - 'capabilities': 'capabilities' - } - - def __init__(self, id=None, title=None, html_url=None, type=None, privacy=None, sharing_key=None, app=None, user=None, rights=None, collaborators=None, capabilities=None): # noqa: E501 - """Collection - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._title = None - self._html_url = None - self._type = None - self._privacy = None - self._sharing_key = None - self._app = None - self._user = None - self._rights = None - self._collaborators = None - self._capabilities = None - self.discriminator = None - - if id is not None: - self.id = id - if title is not None: - self.title = title - if html_url is not None: - self.html_url = html_url - if type is not None: - self.type = type - if privacy is not None: - self.privacy = privacy - if sharing_key is not None: - self.sharing_key = sharing_key - if app is not None: - self.app = app - if user is not None: - self.user = user - if rights is not None: - self.rights = rights - if collaborators is not None: - self.collaborators = collaborators - if capabilities is not None: - self.capabilities = capabilities - - @property - def id(self): - """Gets the id of this Collection. # noqa: E501 - - Unique identifier of the collection # noqa: E501 - - :return: The id of this Collection. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Collection. - - Unique identifier of the collection # noqa: E501 - - :param id: The id of this Collection. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def title(self): - """Gets the title of this Collection. # noqa: E501 - - - :return: The title of this Collection. # noqa: E501 - :rtype: CollectionTitle - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this Collection. - - - :param title: The title of this Collection. # noqa: E501 - :type: CollectionTitle - """ - - self._title = title - - @property - def html_url(self): - """Gets the html_url of this Collection. # noqa: E501 - - The url where the collection can be viewed in a web browser # noqa: E501 - - :return: The html_url of this Collection. # noqa: E501 - :rtype: str - """ - return self._html_url - - @html_url.setter - def html_url(self, html_url): - """Sets the html_url of this Collection. - - The url where the collection can be viewed in a web browser # noqa: E501 - - :param html_url: The html_url of this Collection. # noqa: E501 - :type: str - """ - - self._html_url = html_url - - @property - def type(self): - """Gets the type of this Collection. # noqa: E501 - - - :return: The type of this Collection. # noqa: E501 - :rtype: CollectionType - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this Collection. - - - :param type: The type of this Collection. # noqa: E501 - :type: CollectionType - """ - - self._type = type - - @property - def privacy(self): - """Gets the privacy of this Collection. # noqa: E501 - - - :return: The privacy of this Collection. # noqa: E501 - :rtype: CollectionPrivacy - """ - return self._privacy - - @privacy.setter - def privacy(self, privacy): - """Sets the privacy of this Collection. - - - :param privacy: The privacy of this Collection. # noqa: E501 - :type: CollectionPrivacy - """ - - self._privacy = privacy - - @property - def sharing_key(self): - """Gets the sharing_key of this Collection. # noqa: E501 - - The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :return: The sharing_key of this Collection. # noqa: E501 - :rtype: str - """ - return self._sharing_key - - @sharing_key.setter - def sharing_key(self, sharing_key): - """Sets the sharing_key of this Collection. - - The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :param sharing_key: The sharing_key of this Collection. # noqa: E501 - :type: str - """ - - self._sharing_key = sharing_key - - @property - def app(self): - """Gets the app of this Collection. # noqa: E501 - - If this directory is dedicated to an app, the unique idenfier of this app # noqa: E501 - - :return: The app of this Collection. # noqa: E501 - :rtype: str - """ - return self._app - - @app.setter - def app(self, app): - """Sets the app of this Collection. - - If this directory is dedicated to an app, the unique idenfier of this app # noqa: E501 - - :param app: The app of this Collection. # noqa: E501 - :type: str - """ - - self._app = app - - @property - def user(self): - """Gets the user of this Collection. # noqa: E501 - - - :return: The user of this Collection. # noqa: E501 - :rtype: UserPublicSummary - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this Collection. - - - :param user: The user of this Collection. # noqa: E501 - :type: UserPublicSummary - """ - - self._user = user - - @property - def rights(self): - """Gets the rights of this Collection. # noqa: E501 - - - :return: The rights of this Collection. # noqa: E501 - :rtype: ResourceRights - """ - return self._rights - - @rights.setter - def rights(self, rights): - """Sets the rights of this Collection. - - - :param rights: The rights of this Collection. # noqa: E501 - :type: ResourceRights - """ - - self._rights = rights - - @property - def collaborators(self): - """Gets the collaborators of this Collection. # noqa: E501 - - The list of the collaborators of the collection # noqa: E501 - - :return: The collaborators of this Collection. # noqa: E501 - :rtype: list[ResourceCollaborator] - """ - return self._collaborators - - @collaborators.setter - def collaborators(self, collaborators): - """Sets the collaborators of this Collection. - - The list of the collaborators of the collection # noqa: E501 - - :param collaborators: The collaborators of this Collection. # noqa: E501 - :type: list[ResourceCollaborator] - """ - - self._collaborators = collaborators - - @property - def capabilities(self): - """Gets the capabilities of this Collection. # noqa: E501 - - - :return: The capabilities of this Collection. # noqa: E501 - :rtype: CollectionCapabilities - """ - return self._capabilities - - @capabilities.setter - def capabilities(self, capabilities): - """Sets the capabilities of this Collection. - - - :param capabilities: The capabilities of this Collection. # noqa: E501 - :type: CollectionCapabilities - """ - - self._capabilities = capabilities - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Collection): - return False + Collection of scores + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the collection") + title: StrictStr = Field(description="The title of the collection") + html_url: StrictStr = Field(description="The url where the collection can be viewed in a web browser", alias="htmlUrl") + type: CollectionType + label_key: Optional[StrictStr] = Field(default=None, description="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. ", alias="labelKey") + privacy: CollectionPrivacy + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the collection (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + app: Optional[CollectionApp] = None + creation_date: datetime = Field(description="The date when the collection was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date when the collection was last modified", alias="modificationDate") + user: Optional[UserPublicSummary] = None + organization: Optional[StrictStr] = Field(default=None, description="If the score has been created in an organization, the identifier of this organization. ") + rights: Optional[ResourceRights] = None + collaborators: Optional[List[ResourceCollaborator]] = Field(default=None, description="The list of the collaborators of the collection") + is_pinned: Optional[StrictBool] = Field(default=None, description="Whether the collection is pinned by the owner", alias="isPinned") + contents: CollectionContents + capabilities: CollectionCapabilities + collections: Optional[List[StrictStr]] = Field(default=None, description="The list of parent collections this score is included in. Please note that you might not have access to all of them.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "htmlUrl", "type", "labelKey", "privacy", "sharingKey", "app", "creationDate", "modificationDate", "user", "organization", "rights", "collaborators", "isPinned", "contents", "capabilities", "collections"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Collection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of app + if self.app: + _dict['app'] = self.app.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of rights + if self.rights: + _dict['rights'] = self.rights.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collaborators (list) + _items = [] + if self.collaborators: + for _item_collaborators in self.collaborators: + if _item_collaborators: + _items.append(_item_collaborators.to_dict()) + _dict['collaborators'] = _items + # override the default output from pydantic by calling `to_dict()` of contents + if self.contents: + _dict['contents'] = self.contents.to_dict() + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Collection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "htmlUrl": obj.get("htmlUrl"), + "type": obj.get("type"), + "labelKey": obj.get("labelKey"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE, + "sharingKey": obj.get("sharingKey"), + "app": CollectionApp.from_dict(obj["app"]) if obj.get("app") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "user": UserPublicSummary.from_dict(obj["user"]) if obj.get("user") is not None else None, + "organization": obj.get("organization"), + "rights": ResourceRights.from_dict(obj["rights"]) if obj.get("rights") is not None else None, + "collaborators": [ResourceCollaborator.from_dict(_item) for _item in obj["collaborators"]] if obj.get("collaborators") is not None else None, + "isPinned": obj.get("isPinned"), + "contents": CollectionContents.from_dict(obj["contents"]) if obj.get("contents") is not None else None, + "capabilities": CollectionCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "collections": obj.get("collections") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_app.py b/flat_api/models/collection_app.py new file mode 100644 index 0000000..e8888fb --- /dev/null +++ b/flat_api/models/collection_app.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionApp(BaseModel): + """ + For App collections, the details of the app that created the collection + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The app unique identifier") + name: Optional[StrictStr] = Field(default=None, description="The name of the app") + logo: Optional[StrictStr] = Field(default=None, description="The app logo url") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "logo"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionApp from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionApp from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "logo": obj.get("logo") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/collection_capabilities.py b/flat_api/models/collection_capabilities.py index 3d47ee0..62a3724 100644 --- a/flat_api/models/collection_capabilities.py +++ b/flat_api/models/collection_capabilities.py @@ -3,224 +3,108 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class CollectionCapabilities(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class CollectionCapabilities(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'can_edit': 'bool', - 'can_share': 'bool', - 'can_delete': 'bool', - 'can_add_scores': 'bool', - 'can_delete_scores': 'bool' - } - - attribute_map = { - 'can_edit': 'canEdit', - 'can_share': 'canShare', - 'can_delete': 'canDelete', - 'can_add_scores': 'canAddScores', - 'can_delete_scores': 'canDeleteScores' - } - - def __init__(self, can_edit=None, can_share=None, can_delete=None, can_add_scores=None, can_delete_scores=None): # noqa: E501 - """CollectionCapabilities - a model defined in Swagger""" # noqa: E501 - - self._can_edit = None - self._can_share = None - self._can_delete = None - self._can_add_scores = None - self._can_delete_scores = None - self.discriminator = None - - if can_edit is not None: - self.can_edit = can_edit - if can_share is not None: - self.can_share = can_share - if can_delete is not None: - self.can_delete = can_delete - if can_add_scores is not None: - self.can_add_scores = can_add_scores - if can_delete_scores is not None: - self.can_delete_scores = can_delete_scores - - @property - def can_edit(self): - """Gets the can_edit of this CollectionCapabilities. # noqa: E501 - - Whether the current user can modify the metadata for the collection # noqa: E501 - - :return: The can_edit of this CollectionCapabilities. # noqa: E501 - :rtype: bool - """ - return self._can_edit - - @can_edit.setter - def can_edit(self, can_edit): - """Sets the can_edit of this CollectionCapabilities. - - Whether the current user can modify the metadata for the collection # noqa: E501 - - :param can_edit: The can_edit of this CollectionCapabilities. # noqa: E501 - :type: bool - """ - - self._can_edit = can_edit - - @property - def can_share(self): - """Gets the can_share of this CollectionCapabilities. # noqa: E501 - - Whether the current user can modify the sharing settings for the collection # noqa: E501 - - :return: The can_share of this CollectionCapabilities. # noqa: E501 - :rtype: bool - """ - return self._can_share - - @can_share.setter - def can_share(self, can_share): - """Sets the can_share of this CollectionCapabilities. - - Whether the current user can modify the sharing settings for the collection # noqa: E501 - - :param can_share: The can_share of this CollectionCapabilities. # noqa: E501 - :type: bool - """ - - self._can_share = can_share - - @property - def can_delete(self): - """Gets the can_delete of this CollectionCapabilities. # noqa: E501 - - Whether the current user can delete the collection # noqa: E501 - - :return: The can_delete of this CollectionCapabilities. # noqa: E501 - :rtype: bool - """ - return self._can_delete - - @can_delete.setter - def can_delete(self, can_delete): - """Sets the can_delete of this CollectionCapabilities. - - Whether the current user can delete the collection # noqa: E501 - - :param can_delete: The can_delete of this CollectionCapabilities. # noqa: E501 - :type: bool - """ - - self._can_delete = can_delete - - @property - def can_add_scores(self): - """Gets the can_add_scores of this CollectionCapabilities. # noqa: E501 - - 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. # noqa: E501 - - :return: The can_add_scores of this CollectionCapabilities. # noqa: E501 - :rtype: bool + Capabilities the current user has on this collection. Each capability corresponds to a fine-grained action that a user may take. + """ # noqa: E501 + can_edit: StrictBool = Field(description="Whether the current user can modify the metadata for the collection ", alias="canEdit") + can_share: StrictBool = Field(description="Whether the current user can modify the sharing settings for the collection ", alias="canShare") + can_delete: StrictBool = Field(description="Whether the current user can delete the collection ", alias="canDelete") + can_add_scores: StrictBool = Field(description="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. ", alias="canAddScores") + can_delete_scores: StrictBool = Field(description="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. ", alias="canDeleteScores") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canShare", "canDelete", "canAddScores", "canDeleteScores"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._can_add_scores + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canShare": obj.get("canShare"), + "canDelete": obj.get("canDelete"), + "canAddScores": obj.get("canAddScores"), + "canDeleteScores": obj.get("canDeleteScores") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @can_add_scores.setter - def can_add_scores(self, can_add_scores): - """Sets the can_add_scores of this CollectionCapabilities. - - 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. # noqa: E501 - - :param can_add_scores: The can_add_scores of this CollectionCapabilities. # noqa: E501 - :type: bool - """ - - self._can_add_scores = can_add_scores - - @property - def can_delete_scores(self): - """Gets the can_delete_scores of this CollectionCapabilities. # noqa: E501 - - 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. # noqa: E501 - - :return: The can_delete_scores of this CollectionCapabilities. # noqa: E501 - :rtype: bool - """ - return self._can_delete_scores - - @can_delete_scores.setter - def can_delete_scores(self, can_delete_scores): - """Sets the can_delete_scores of this CollectionCapabilities. - - 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. # noqa: E501 - - :param can_delete_scores: The can_delete_scores of this CollectionCapabilities. # noqa: E501 - :type: bool - """ - self._can_delete_scores = can_delete_scores - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionCapabilities): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_contents.py b/flat_api/models/collection_contents.py new file mode 100644 index 0000000..f209849 --- /dev/null +++ b/flat_api/models/collection_contents.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionContents(BaseModel): + """ + The contents of the collection + """ # noqa: E501 + scores_count: StrictInt = Field(description="The number of scores in the collection", alias="scoresCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scoresCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionContents from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionContents from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scoresCount": obj.get("scoresCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/collection_creation.py b/flat_api/models/collection_creation.py index dab4a00..4507788 100644 --- a/flat_api/models/collection_creation.py +++ b/flat_api/models/collection_creation.py @@ -3,113 +3,104 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.collection_title import CollectionTitle # noqa: F401,E501 - +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.collection_privacy import CollectionPrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CollectionCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +class CollectionCreation(BaseModel): """ - swagger_types = { - 'title': 'CollectionTitle' - } - - attribute_map = { - 'title': 'title' - } - - def __init__(self, title=None): # noqa: E501 - """CollectionCreation - a model defined in Swagger""" # noqa: E501 - - self._title = None - self.discriminator = None - - self.title = title - - @property - def title(self): - """Gets the title of this CollectionCreation. # noqa: E501 - - - :return: The title of this CollectionCreation. # noqa: E501 - :rtype: CollectionTitle + CollectionCreation + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="The title of the collection") + privacy: Optional[CollectionPrivacy] = CollectionPrivacy.PRIVATE + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._title + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @title.setter - def title(self, title): - """Sets the title of this CollectionCreation. - - :param title: The title of this CollectionCreation. # noqa: E501 - :type: CollectionTitle - """ - if title is None: - raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 - - self._title = title - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_modification.py b/flat_api/models/collection_modification.py index 25ec5fe..4c2b462 100644 --- a/flat_api/models/collection_modification.py +++ b/flat_api/models/collection_modification.py @@ -3,112 +3,104 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.collection_title import CollectionTitle # noqa: F401,E501 - +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.collection_privacy import CollectionPrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CollectionModification(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +class CollectionModification(BaseModel): """ - swagger_types = { - 'title': 'CollectionTitle' - } - - attribute_map = { - 'title': 'title' - } - - def __init__(self, title=None): # noqa: E501 - """CollectionModification - a model defined in Swagger""" # noqa: E501 - - self._title = None - self.discriminator = None - - if title is not None: - self.title = title - - @property - def title(self): - """Gets the title of this CollectionModification. # noqa: E501 - - - :return: The title of this CollectionModification. # noqa: E501 - :rtype: CollectionTitle + Edit the collection metadata + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="The title of the collection") + privacy: Optional[CollectionPrivacy] = CollectionPrivacy.PRIVATE + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionModification from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this CollectionModification. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionModification from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else CollectionPrivacy.PRIVATE + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param title: The title of this CollectionModification. # noqa: E501 - :type: CollectionTitle - """ - - self._title = title - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionModification): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_privacy.py b/flat_api/models/collection_privacy.py index 79bd033..daac96e 100644 --- a/flat_api/models/collection_privacy.py +++ b/flat_api/models/collection_privacy.py @@ -3,87 +3,35 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class CollectionPrivacy(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class CollectionPrivacy(str, Enum): """ - allowed enum values + The collection main privacy mode. - `private`: The collection is private and can only be accessed, modified, and administered by specified collaborators. """ - PRIVATE = "private" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """CollectionPrivacy - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + PRIVATE = 'private' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionPrivacy): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CollectionPrivacy from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_title.py b/flat_api/models/collection_title.py deleted file mode 100644 index 4bddfe4..0000000 --- a/flat_api/models/collection_title.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class CollectionTitle(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """CollectionTitle - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionTitle): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/collection_type.py b/flat_api/models/collection_type.py index bf62e08..170f57d 100644 --- a/flat_api/models/collection_type.py +++ b/flat_api/models/collection_type.py @@ -3,91 +3,41 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class CollectionType(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class CollectionType(str, Enum): """ - allowed enum values + Type of the collection. The type will influence the capabilities available on the collections and how this collection is/can be populated. - `root`: **Deprecated.** Previously the root collection of the user. The `allScores` virtual collection should be used instead. - `regular`: A regular collection created by the user. This collection can be deleted and modified by the user. - `app`: An automatically created collection containing the scores created by an app (e.g. Music Snippet) - `trash`: An automatically created collection containing the trashed scores. Virtual collections: - `allScores`: All the scores contained in the user account - `collaborations`: All shared scores by the user or someone else - `likes`: Liked scores """ - ROOT = "root" - REGULAR = "regular" - SHAREDWITHME = "sharedWithMe" - SHAREDWITHGROUP = "sharedWithGroup" - TRASH = "trash" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """CollectionType - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + ROOT = 'root' + REGULAR = 'regular' + APP = 'app' + TRASH = 'trash' + ALLSCORES = 'allScores' + COLLABORATIONS = 'collaborations' + LIKES = 'likes' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionType): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CollectionType from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/credit_transaction.py b/flat_api/models/credit_transaction.py new file mode 100644 index 0000000..a346f0c --- /dev/null +++ b/flat_api/models/credit_transaction.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CreditTransaction(BaseModel): + """ + A single credit ledger entry + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the credit transaction") + type: StrictStr = Field(description="Credit category. `ai` covers every AI-powered feature.") + feature: Optional[StrictStr] = Field(default=None, description="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. ") + amount: StrictInt = Field(description="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: StrictStr = Field(description="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: StrictStr = Field(description="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: Optional[StrictStr] = Field(default=None, description="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. ") + creation_date: datetime = Field(description="When the transaction was created", alias="creationDate") + modification_date: datetime = Field(description="When the transaction was last modified", alias="modificationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "feature", "amount", "source", "state", "job", "creationDate", "modificationDate"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ai']): + raise ValueError("must be one of enum values ('ai')") + return value + + @field_validator('feature') + def feature_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['omr']): + raise ValueError("must be one of enum values ('omr')") + return value + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['subscription', 'purchase', 'free_tier', 'support']): + raise ValueError("must be one of enum values ('subscription', 'purchase', 'free_tier', 'support')") + return value + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['active', 'canceled']): + raise ValueError("must be one of enum values ('active', 'canceled')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreditTransaction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreditTransaction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "feature": obj.get("feature"), + "amount": obj.get("amount"), + "source": obj.get("source"), + "state": obj.get("state"), + "job": obj.get("job"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_library.py b/flat_api/models/edu_library.py new file mode 100644 index 0000000..fc5cded --- /dev/null +++ b/flat_api/models/edu_library.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduLibrary(BaseModel): + """ + A Flat for Education Library + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the library. This one can be used to list the underlying resources using `GET /v2/eduResources?parent={library-id}` ") + name: StrictStr = Field(description="Name of the library") + type: StrictStr = Field(description="Type of the library") + visibility: StrictStr = Field(description="Visibility of the library") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "visibility"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['myResources', 'organizationResources', 'flatEduContent']): + raise ValueError("must be one of enum values ('myResources', 'organizationResources', 'flatEduContent')") + return value + + @field_validator('visibility') + def visibility_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['private', 'organization', 'public']): + raise ValueError("must be one of enum values ('private', 'organization', 'public')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduLibrary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduLibrary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "visibility": obj.get("visibility") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource.py b/flat_api/models/edu_resource.py new file mode 100644 index 0000000..abc32da --- /dev/null +++ b/flat_api/models/edu_resource.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.edu_resource_capabilities import EduResourceCapabilities +from flat_api.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.models.edu_resource_resource import EduResourceResource +from flat_api.models.edu_resource_type import EduResourceType +from flat_api.models.grade import Grade +from flat_api.models.teaching_theme import TeachingTheme +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResource(BaseModel): + """ + A Flat for Education resource contained in a resources library + """ # noqa: E501 + id: StrictStr = Field(description="Resource unique identifier") + creator: Optional[StrictStr] = Field(default=None, description="The User identifier of the resource creator") + type: EduResourceType + privacy: Optional[EduResourcePrivacy] = EduResourcePrivacy.PRIVATE + tags: Optional[List[StrictStr]] = Field(default=None, description="Specific attributes for the resource (e.g. sample resources with custom design)") + parent: Optional[StrictStr] = Field(default=None, description="Identifier of the parent resource, e.g. a folder or root") + title: StrictStr = Field(description="Title of the resource") + sharing_description: Optional[StrictStr] = Field(default=None, description="Sharing description of this resource", alias="sharingDescription") + sharing_description_html: Optional[StrictStr] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + creation_date: Optional[datetime] = Field(default=None, description="The date when the resource was created", alias="creationDate") + update_date: Optional[datetime] = Field(default=None, description="The date when the resource was updated", alias="updateDate") + resource: Optional[EduResourceResource] = None + capabilities: EduResourceCapabilities + subjects: Optional[List[TeachingTheme]] = Field(default=None, description="The subjects of this resource, or the subjects of the resources included in the folder") + grades: Optional[List[Grade]] = Field(default=None, description="The grades of this resource, or the grades of the resources included in the folder.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creator", "type", "privacy", "tags", "parent", "title", "sharingDescription", "sharingDescriptionHtml", "creationDate", "updateDate", "resource", "capabilities", "subjects", "grades"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResource from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of resource + if self.resource: + _dict['resource'] = self.resource.to_dict() + # override the default output from pydantic by calling `to_dict()` of capabilities + if self.capabilities: + _dict['capabilities'] = self.capabilities.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creator": obj.get("creator"), + "type": obj.get("type"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else EduResourcePrivacy.PRIVATE, + "tags": obj.get("tags"), + "parent": obj.get("parent"), + "title": obj.get("title"), + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "creationDate": obj.get("creationDate"), + "updateDate": obj.get("updateDate"), + "resource": EduResourceResource.from_dict(obj["resource"]) if obj.get("resource") is not None else None, + "capabilities": EduResourceCapabilities.from_dict(obj["capabilities"]) if obj.get("capabilities") is not None else None, + "subjects": obj.get("subjects"), + "grades": obj.get("grades") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_assignment_creation.py b/flat_api/models/edu_resource_assignment_creation.py new file mode 100644 index 0000000..4e70c23 --- /dev/null +++ b/flat_api/models/edu_resource_assignment_creation.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.assignment_type import AssignmentType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceAssignmentCreation(BaseModel): + """ + Assignment-specific creation options. Only applicable when creating a resource with `type: assignment`. If `type` is not provided, defaults to `none`. + """ # noqa: E501 + type: Optional[AssignmentType] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceAssignmentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceAssignmentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_capabilities.py b/flat_api/models/edu_resource_capabilities.py new file mode 100644 index 0000000..2908470 --- /dev/null +++ b/flat_api/models/edu_resource_capabilities.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCapabilities(BaseModel): + """ + Capabilities available for this resource + """ # noqa: E501 + can_edit: Optional[StrictBool] = Field(default=None, description="Whether the current user can modify this resource ", alias="canEdit") + can_add_resources: Optional[StrictBool] = Field(default=None, description="Whether the current user can add resources within this resource (e.g. `assignment` inside a `folder`) ", alias="canAddResources") + can_add_folders: Optional[StrictBool] = Field(default=None, description="Whether the current user can add folders within this resource (e.g. `folder` inside `root`) ", alias="canAddFolders") + can_change_privacy: Optional[StrictBool] = Field(default=None, description="Whether the current user can change the privacy of this resource (e.g. to share as `organizationPublic` or unshare it with `private`) ", alias="canChangePrivacy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canEdit", "canAddResources", "canAddFolders", "canChangePrivacy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canEdit": obj.get("canEdit"), + "canAddResources": obj.get("canAddResources"), + "canAddFolders": obj.get("canAddFolders"), + "canChangePrivacy": obj.get("canChangePrivacy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_copy.py b/flat_api/models/edu_resource_copy.py new file mode 100644 index 0000000..c4a4278 --- /dev/null +++ b/flat_api/models/edu_resource_copy.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCopy(BaseModel): + """ + Copy an education resource + """ # noqa: E501 + destination: StrictStr = Field(description="Unique identifier of the destination folder for the copy. This can also be `root` to copy the resource at the root of the user resource library. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCopy from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCopy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_creation.py b/flat_api/models/edu_resource_creation.py new file mode 100644 index 0000000..122677f --- /dev/null +++ b/flat_api/models/edu_resource_creation.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.edu_resource_assignment_creation import EduResourceAssignmentCreation +from flat_api.models.edu_resource_type import EduResourceType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceCreation(BaseModel): + """ + Creation of an education resource + """ # noqa: E501 + type: EduResourceType + title: Annotated[str, Field(min_length=1, strict=True, max_length=1000)] = Field(description="Title of the resource") + parent: Optional[StrictStr] = Field(default='root', description="Identifier of the parent resource where the new one will be created, e.g. a folder id or `root`") + sharing_description: Optional[Annotated[str, Field(strict=True, max_length=400)]] = Field(default=None, description="Sharing description of the resource", alias="sharingDescription") + sharing_description_html: Optional[Annotated[str, Field(strict=True, max_length=10000)]] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + resource: Optional[EduResourceAssignmentCreation] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "title", "parent", "sharingDescription", "sharingDescriptionHtml", "resource"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of resource + if self.resource: + _dict['resource'] = self.resource.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "title": obj.get("title"), + "parent": obj.get("parent") if obj.get("parent") is not None else 'root', + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "resource": EduResourceAssignmentCreation.from_dict(obj["resource"]) if obj.get("resource") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_folder.py b/flat_api/models/edu_resource_folder.py new file mode 100644 index 0000000..924bc22 --- /dev/null +++ b/flat_api/models/edu_resource_folder.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.assignment_type import AssignmentType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceFolder(BaseModel): + """ + Education resources folder + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the folder") + assignments_types: Optional[List[AssignmentType]] = Field(default=None, description="The assignment types of the resources included in the folder", alias="assignmentsTypes") + resources_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of resources inside the folder", alias="resourcesCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "assignmentsTypes", "resourcesCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceFolder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceFolder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "assignmentsTypes": obj.get("assignmentsTypes"), + "resourcesCount": obj.get("resourcesCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_lti_link.py b/flat_api/models/edu_resource_lti_link.py new file mode 100644 index 0000000..c946422 --- /dev/null +++ b/flat_api/models/edu_resource_lti_link.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceLtiLink(BaseModel): + """ + LTI Link details for the class + """ # noqa: E501 + lti_url: StrictStr = Field(description="A URL that can be used to launch LTI with this resource in a classroom.", alias="ltiUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ltiUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceLtiLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceLtiLink from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ltiUrl": obj.get("ltiUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_move.py b/flat_api/models/edu_resource_move.py new file mode 100644 index 0000000..f622df6 --- /dev/null +++ b/flat_api/models/edu_resource_move.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceMove(BaseModel): + """ + Move an education resource + """ # noqa: E501 + destination: StrictStr = Field(description="Unique identifier of the destination folder for this resource. This can also be `root` to move the resource at the root of the user resource library. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceMove from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceMove from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_privacy.py b/flat_api/models/edu_resource_privacy.py new file mode 100644 index 0000000..b808c3e --- /dev/null +++ b/flat_api/models/edu_resource_privacy.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EduResourcePrivacy(str, Enum): + """ + The Education resource privacy mode. + """ + + """ + allowed enum values + """ + PRIVATE = 'private' + ORGANIZATIONPUBLIC = 'organizationPublic' + PUBLIC = 'public' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EduResourcePrivacy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/edu_resource_resource.py b/flat_api/models/edu_resource_resource.py new file mode 100644 index 0000000..eeb1f6a --- /dev/null +++ b/flat_api/models/edu_resource_resource.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.assignment import Assignment +from flat_api.models.edu_resource_folder import EduResourceFolder +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +EDURESOURCERESOURCE_ONE_OF_SCHEMAS = ["Assignment", "EduResourceFolder"] + +class EduResourceResource(BaseModel): + """ + EduResourceResource + """ + # data type: Assignment + oneof_schema_1_validator: Optional[Assignment] = None + # data type: EduResourceFolder + oneof_schema_2_validator: Optional[EduResourceFolder] = None + actual_instance: Optional[Union[Assignment, EduResourceFolder]] = None + one_of_schemas: Set[str] = { "Assignment", "EduResourceFolder" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = EduResourceResource.model_construct() + error_messages = [] + match = 0 + # validate data type: Assignment + if not isinstance(v, Assignment): + error_messages.append(f"Error! Input type `{type(v)}` is not `Assignment`") + else: + match += 1 + # validate data type: EduResourceFolder + if not isinstance(v, EduResourceFolder): + error_messages.append(f"Error! Input type `{type(v)}` is not `EduResourceFolder`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into Assignment + try: + instance.actual_instance = Assignment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into EduResourceFolder + try: + instance.actual_instance = EduResourceFolder.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into EduResourceResource with oneOf schemas: Assignment, EduResourceFolder. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], Assignment, EduResourceFolder]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/edu_resource_type.py b/flat_api/models/edu_resource_type.py new file mode 100644 index 0000000..1a8e0e4 --- /dev/null +++ b/flat_api/models/edu_resource_type.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EduResourceType(str, Enum): + """ + Type of an education resource + """ + + """ + allowed enum values + """ + ASSIGNMENT = 'assignment' + FOLDER = 'folder' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EduResourceType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/edu_resource_update.py b/flat_api/models/edu_resource_update.py new file mode 100644 index 0000000..33808c6 --- /dev/null +++ b/flat_api/models/edu_resource_update.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.edu_resource_privacy import EduResourcePrivacy +from flat_api.models.grade import Grade +from flat_api.models.teaching_theme import TeachingTheme +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceUpdate(BaseModel): + """ + Update of an education resource + """ # noqa: E501 + title: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="Title of the resource") + sharing_description: Optional[Annotated[str, Field(strict=True, max_length=400)]] = Field(default=None, description="Sharing description of the resource", alias="sharingDescription") + sharing_description_html: Optional[Annotated[str, Field(strict=True, max_length=10000)]] = Field(default=None, description="HTML version of sharing description with rich text formatting. Supports safe HTML tags: p, br, strong, b, em, i, u, a. ", alias="sharingDescriptionHtml") + privacy: Optional[EduResourcePrivacy] = EduResourcePrivacy.PRIVATE + subjects: Optional[List[TeachingTheme]] = Field(default=None, description="The subjects of this resource, or the subjects of the resources included in the folder") + grades: Optional[List[Grade]] = Field(default=None, description="The grades of this resource, or the grades of the resources included in the folder.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "sharingDescription", "sharingDescriptionHtml", "privacy", "subjects", "grades"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "sharingDescription": obj.get("sharingDescription"), + "sharingDescriptionHtml": obj.get("sharingDescriptionHtml"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else EduResourcePrivacy.PRIVATE, + "subjects": obj.get("subjects"), + "grades": obj.get("grades") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/edu_resource_use_in_class.py b/flat_api/models/edu_resource_use_in_class.py new file mode 100644 index 0000000..b63a5d6 --- /dev/null +++ b/flat_api/models/edu_resource_use_in_class.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EduResourceUseInClass(BaseModel): + """ + Use an education resource in class + """ # noqa: E501 + classroom: StrictStr = Field(description="The destination classroom where the resource will be copied.") + assignment: Optional[StrictStr] = Field(default=None, description="An optional destination assignment where the original assignment will be copied. Must be a draft.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["classroom", "assignment"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EduResourceUseInClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EduResourceUseInClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/flat_error_response.py b/flat_api/models/flat_error_response.py index 4224dc1..92cbab6 100644 --- a/flat_api/models/flat_error_response.py +++ b/flat_api/models/flat_error_response.py @@ -3,196 +3,108 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class FlatErrorResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class FlatErrorResponse(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'code': 'str', - 'message': 'str', - 'id': 'str', - 'param': 'str' - } - - attribute_map = { - 'code': 'code', - 'message': 'message', - 'id': 'id', - 'param': 'param' - } - - def __init__(self, code=None, message=None, id=None, param=None): # noqa: E501 - """FlatErrorResponse - a model defined in Swagger""" # noqa: E501 - - self._code = None - self._message = None - self._id = None - self._param = None - self.discriminator = None - - if code is not None: - self.code = code - if message is not None: - self.message = message - if id is not None: - self.id = id - if param is not None: - self.param = param - - @property - def code(self): - """Gets the code of this FlatErrorResponse. # noqa: E501 - - A corresponding code for this error # noqa: E501 - - :return: The code of this FlatErrorResponse. # noqa: E501 - :rtype: str - """ - return self._code - - @code.setter - def code(self, code): - """Sets the code of this FlatErrorResponse. - - A corresponding code for this error # noqa: E501 - - :param code: The code of this FlatErrorResponse. # noqa: E501 - :type: str - """ - - self._code = code - - @property - def message(self): - """Gets the message of this FlatErrorResponse. # noqa: E501 - - A printable message for this message # noqa: E501 - - :return: The message of this FlatErrorResponse. # noqa: E501 - :rtype: str + An API Error response + """ # noqa: E501 + code: StrictStr = Field(description="A corresponding code for this error") + message: StrictStr = Field(description="A printable message for this error") + id: Optional[StrictStr] = Field(default=None, description="A unique error identifier generated for the request") + param: Optional[StrictStr] = Field(default=None, description="The related parameter that caused the error") + provider_message: Optional[StrictStr] = Field(default=None, description="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. ", alias="providerMessage") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "id", "param", "providerMessage"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FlatErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._message - - @message.setter - def message(self, message): - """Sets the message of this FlatErrorResponse. - - A printable message for this message # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FlatErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "id": obj.get("id"), + "param": obj.get("param"), + "providerMessage": obj.get("providerMessage") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param message: The message of this FlatErrorResponse. # noqa: E501 - :type: str - """ - - self._message = message - - @property - def id(self): - """Gets the id of this FlatErrorResponse. # noqa: E501 - - An unique error identifier generated for the request # noqa: E501 - - :return: The id of this FlatErrorResponse. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this FlatErrorResponse. - - An unique error identifier generated for the request # noqa: E501 - - :param id: The id of this FlatErrorResponse. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def param(self): - """Gets the param of this FlatErrorResponse. # noqa: E501 - - The related parameter that caused the error # noqa: E501 - - :return: The param of this FlatErrorResponse. # noqa: E501 - :rtype: str - """ - return self._param - - @param.setter - def param(self, param): - """Sets the param of this FlatErrorResponse. - - The related parameter that caused the error # noqa: E501 - - :param param: The param of this FlatErrorResponse. # noqa: E501 - :type: str - """ - self._param = param - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FlatErrorResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/flat_locales.py b/flat_api/models/flat_locales.py deleted file mode 100644 index b7cb2de..0000000 --- a/flat_api/models/flat_locales.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FlatLocales(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - EN = "en" - ES = "es" - FR = "fr" - IT = "it" - PL = "pl" - RO = "ro" - NL = "nl" - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """FlatLocales - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FlatLocales): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/google_classroom_coursework.py b/flat_api/models/google_classroom_coursework.py index 6768b22..6b9d252 100644 --- a/flat_api/models/google_classroom_coursework.py +++ b/flat_api/models/google_classroom_coursework.py @@ -3,168 +3,111 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class GoogleClassroomCoursework(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class GoogleClassroomCoursework(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'state': 'str', - 'alternate_link': 'str' - } - - attribute_map = { - 'id': 'id', - 'state': 'state', - 'alternate_link': 'alternateLink' - } - - def __init__(self, id=None, state=None, alternate_link=None): # noqa: E501 - """GoogleClassroomCoursework - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._state = None - self._alternate_link = None - self.discriminator = None - - if id is not None: - self.id = id - if state is not None: - self.state = state - if alternate_link is not None: - self.alternate_link = alternate_link - - @property - def id(self): - """Gets the id of this GoogleClassroomCoursework. # noqa: E501 - - Identifier of the coursework assigned by Classroom # noqa: E501 - - :return: The id of this GoogleClassroomCoursework. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this GoogleClassroomCoursework. - - Identifier of the coursework assigned by Classroom # noqa: E501 - - :param id: The id of this GoogleClassroomCoursework. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def state(self): - """Gets the state of this GoogleClassroomCoursework. # noqa: E501 - - State of the coursework # noqa: E501 - - :return: The state of this GoogleClassroomCoursework. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this GoogleClassroomCoursework. - - State of the coursework # noqa: E501 - - :param state: The state of this GoogleClassroomCoursework. # noqa: E501 - :type: str + A coursework on Google Classroom + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifier of the coursework assigned by Classroom") + state: Optional[StrictStr] = Field(default=None, description="State of the coursework") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this coursework in the Classroom web UI", alias="alternateLink") + topic_id: Optional[StrictStr] = Field(default=None, description="Identifier of the topic where the assignment is created", alias="topicId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink", "topicId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleClassroomCoursework from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if topic_id (nullable) is None + # and model_fields_set contains the field + if self.topic_id is None and "topic_id" in self.model_fields_set: + _dict['topicId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleClassroomCoursework from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink"), + "topicId": obj.get("topicId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._state = state - - @property - def alternate_link(self): - """Gets the alternate_link of this GoogleClassroomCoursework. # noqa: E501 - - Absolute link to this coursework in the Classroom web UI # noqa: E501 - - :return: The alternate_link of this GoogleClassroomCoursework. # noqa: E501 - :rtype: str - """ - return self._alternate_link - - @alternate_link.setter - def alternate_link(self, alternate_link): - """Sets the alternate_link of this GoogleClassroomCoursework. - - Absolute link to this coursework in the Classroom web UI # noqa: E501 - - :param alternate_link: The alternate_link of this GoogleClassroomCoursework. # noqa: E501 - :type: str - """ - self._alternate_link = alternate_link - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, GoogleClassroomCoursework): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/google_classroom_submission.py b/flat_api/models/google_classroom_submission.py index 4004b34..135982a 100644 --- a/flat_api/models/google_classroom_submission.py +++ b/flat_api/models/google_classroom_submission.py @@ -3,168 +3,104 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class GoogleClassroomSubmission(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class GoogleClassroomSubmission(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'state': 'str', - 'alternate_link': 'str' - } - - attribute_map = { - 'id': 'id', - 'state': 'state', - 'alternate_link': 'alternateLink' - } - - def __init__(self, id=None, state=None, alternate_link=None): # noqa: E501 - """GoogleClassroomSubmission - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._state = None - self._alternate_link = None - self.discriminator = None - - if id is not None: - self.id = id - if state is not None: - self.state = state - if alternate_link is not None: - self.alternate_link = alternate_link - - @property - def id(self): - """Gets the id of this GoogleClassroomSubmission. # noqa: E501 - - Identifier of the coursework submission assigned by Classroom # noqa: E501 - - :return: The id of this GoogleClassroomSubmission. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this GoogleClassroomSubmission. - - Identifier of the coursework submission assigned by Classroom # noqa: E501 - - :param id: The id of this GoogleClassroomSubmission. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def state(self): - """Gets the state of this GoogleClassroomSubmission. # noqa: E501 - - State of the submission on Google Classroom # noqa: E501 - - :return: The state of this GoogleClassroomSubmission. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this GoogleClassroomSubmission. - - State of the submission on Google Classroom # noqa: E501 - - :param state: The state of this GoogleClassroomSubmission. # noqa: E501 - :type: str + A coursework submission on Google Classroom + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of the coursework submission assigned by Classroom") + state: StrictStr = Field(description="State of the submission on Google Classroom") + alternate_link: StrictStr = Field(description="Absolute link to this coursework in the Classroom web UI", alias="alternateLink") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleClassroomSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleClassroomSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._state = state - - @property - def alternate_link(self): - """Gets the alternate_link of this GoogleClassroomSubmission. # noqa: E501 - - Absolute link to this coursework in the Classroom web UI # noqa: E501 - - :return: The alternate_link of this GoogleClassroomSubmission. # noqa: E501 - :rtype: str - """ - return self._alternate_link - - @alternate_link.setter - def alternate_link(self, alternate_link): - """Sets the alternate_link of this GoogleClassroomSubmission. - - Absolute link to this coursework in the Classroom web UI # noqa: E501 - - :param alternate_link: The alternate_link of this GoogleClassroomSubmission. # noqa: E501 - :type: str - """ - self._alternate_link = alternate_link - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, GoogleClassroomSubmission): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/grade.py b/flat_api/models/grade.py new file mode 100644 index 0000000..f23960f --- /dev/null +++ b/flat_api/models/grade.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Grade(str, Enum): + """ + Class grade of the resource + """ + + """ + allowed enum values + """ + ENUM_1 = '1' + ENUM_2 = '2' + ENUM_3 = '3' + ENUM_4 = '4' + ENUM_5 = '5' + ENUM_6 = '6' + ENUM_7 = '7' + ENUM_8 = '8' + ENUM_9 = '9' + ENUM_10 = '10' + ENUM_11 = '11' + ENUM_12 = '12' + UNIVERSITY = 'university' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Grade from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/group.py b/flat_api/models/group.py index 273d420..d2355a4 100644 --- a/flat_api/models/group.py +++ b/flat_api/models/group.py @@ -3,286 +3,114 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.group_type import GroupType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class Group(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class Group(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'type': 'str', - 'users_count': 'float', - 'read_only': 'bool', - 'organization': 'str', - 'creation_date': 'datetime' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'type': 'type', - 'users_count': 'usersCount', - 'read_only': 'readOnly', - 'organization': 'organization', - 'creation_date': 'creationDate' - } - - def __init__(self, id=None, name=None, type=None, users_count=None, read_only=None, organization=None, creation_date=None): # noqa: E501 - """Group - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._type = None - self._users_count = None - self._read_only = None - self._organization = None - self._creation_date = None - self.discriminator = None - - if id is not None: - self.id = id - if name is not None: - self.name = name - if type is not None: - self.type = type - if users_count is not None: - self.users_count = users_count - if read_only is not None: - self.read_only = read_only - if organization is not None: - self.organization = organization - if creation_date is not None: - self.creation_date = creation_date - - @property - def id(self): - """Gets the id of this Group. # noqa: E501 - - The unique identifier of the group # noqa: E501 - - :return: The id of this Group. # noqa: E501 - :rtype: str + A group of users + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of the group") + name: Optional[StrictStr] = Field(default=None, description="The display name of the group") + type: Optional[GroupType] = None + users_count: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of users in this group", alias="usersCount") + read_only: Optional[StrictBool] = Field(default=None, description="`True` if the group is set in read-only ", alias="readOnly") + organization: Optional[StrictStr] = Field(default=None, description="If the group is related to an organization, this field will contain the unique identifier of the organization ") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the group", alias="creationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "usersCount", "readOnly", "organization", "creationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Group from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Group. - - The unique identifier of the group # noqa: E501 - - :param id: The id of this Group. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def name(self): - """Gets the name of this Group. # noqa: E501 - - The display name of the group # noqa: E501 - - :return: The name of this Group. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Group. - - The display name of the group # noqa: E501 - - :param name: The name of this Group. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def type(self): - """Gets the type of this Group. # noqa: E501 - - 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 # noqa: E501 - - :return: The type of this Group. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this Group. - - 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 # noqa: E501 - - :param type: The type of this Group. # noqa: E501 - :type: str - """ - allowed_values = ["generic", "classTeachers", "classStudents"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def users_count(self): - """Gets the users_count of this Group. # noqa: E501 - - The number of users in this group # noqa: E501 - - :return: The users_count of this Group. # noqa: E501 - :rtype: float - """ - return self._users_count - - @users_count.setter - def users_count(self, users_count): - """Sets the users_count of this Group. - - The number of users in this group # noqa: E501 - - :param users_count: The users_count of this Group. # noqa: E501 - :type: float - """ - - self._users_count = users_count - - @property - def read_only(self): - """Gets the read_only of this Group. # noqa: E501 - - `True` if the group is set in read-only # noqa: E501 - - :return: The read_only of this Group. # noqa: E501 - :rtype: bool - """ - return self._read_only - - @read_only.setter - def read_only(self, read_only): - """Sets the read_only of this Group. - - `True` if the group is set in read-only # noqa: E501 - - :param read_only: The read_only of this Group. # noqa: E501 - :type: bool - """ - - self._read_only = read_only - - @property - def organization(self): - """Gets the organization of this Group. # noqa: E501 - - If the group is related to an organization, this field will contain the unique identifier of the organization # noqa: E501 - - :return: The organization of this Group. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this Group. - - If the group is related to an organization, this field will contain the unique identifier of the organization # noqa: E501 - - :param organization: The organization of this Group. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def creation_date(self): - """Gets the creation_date of this Group. # noqa: E501 - - The creation date of the group # noqa: E501 - - :return: The creation_date of this Group. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this Group. - - The creation date of the group # noqa: E501 - - :param creation_date: The creation_date of this Group. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Group): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Group from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "usersCount": obj.get("usersCount"), + "readOnly": obj.get("readOnly"), + "organization": obj.get("organization"), + "creationDate": obj.get("creationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/group_creation.py b/flat_api/models/group_creation.py new file mode 100644 index 0000000..b7eb08d --- /dev/null +++ b/flat_api/models/group_creation.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GroupCreation(BaseModel): + """ + GroupCreation + """ # noqa: E501 + type: StrictStr = Field(description="Type of group (currently only classStudentsSubGroup is supported)") + classroom: StrictStr = Field(description="Classroom ID") + name: Optional[StrictStr] = Field(default=None, description="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`. ") + members: Optional[List[StrictStr]] = Field(default=None, description="Array of student IDs to add to the group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "classroom", "name", "members"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['classStudentsSubGroup']): + raise ValueError("must be one of enum values ('classStudentsSubGroup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "classroom": obj.get("classroom"), + "name": obj.get("name"), + "members": obj.get("members") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/group_details.py b/flat_api/models/group_details.py index 191f9c8..d77a6de 100644 --- a/flat_api/models/group_details.py +++ b/flat_api/models/group_details.py @@ -3,280 +3,122 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.group_type import GroupType # noqa: F401,E501 - - -class GroupDetails(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.group_type import GroupType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class GroupDetails(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'type': 'GroupType', - 'organization': 'str', - 'creation_date': 'datetime', - 'users_count': 'float', - 'read_only': 'bool' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'type': 'type', - 'organization': 'organization', - 'creation_date': 'creationDate', - 'users_count': 'usersCount', - 'read_only': 'readOnly' - } - - def __init__(self, id=None, name=None, type=None, organization=None, creation_date=None, users_count=None, read_only=None): # noqa: E501 - """GroupDetails - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._type = None - self._organization = None - self._creation_date = None - self._users_count = None - self._read_only = None - self.discriminator = None - - if id is not None: - self.id = id - if name is not None: - self.name = name - if type is not None: - self.type = type - if organization is not None: - self.organization = organization - if creation_date is not None: - self.creation_date = creation_date - if users_count is not None: - self.users_count = users_count - if read_only is not None: - self.read_only = read_only - - @property - def id(self): - """Gets the id of this GroupDetails. # noqa: E501 - - The unique identifier of the group # noqa: E501 - - :return: The id of this GroupDetails. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this GroupDetails. - - The unique identifier of the group # noqa: E501 - - :param id: The id of this GroupDetails. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def name(self): - """Gets the name of this GroupDetails. # noqa: E501 - - The displayable name of the group # noqa: E501 - - :return: The name of this GroupDetails. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this GroupDetails. - - The displayable name of the group # noqa: E501 - - :param name: The name of this GroupDetails. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def type(self): - """Gets the type of this GroupDetails. # noqa: E501 - - - :return: The type of this GroupDetails. # noqa: E501 - :rtype: GroupType - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this GroupDetails. - - - :param type: The type of this GroupDetails. # noqa: E501 - :type: GroupType - """ - - self._type = type - - @property - def organization(self): - """Gets the organization of this GroupDetails. # noqa: E501 - - The unique identifier of the Organization owning the group # noqa: E501 - - :return: The organization of this GroupDetails. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this GroupDetails. - - The unique identifier of the Organization owning the group # noqa: E501 - - :param organization: The organization of this GroupDetails. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def creation_date(self): - """Gets the creation_date of this GroupDetails. # noqa: E501 - - The date when the group was create # noqa: E501 - - :return: The creation_date of this GroupDetails. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this GroupDetails. - - The date when the group was create # noqa: E501 - - :param creation_date: The creation_date of this GroupDetails. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def users_count(self): - """Gets the users_count of this GroupDetails. # noqa: E501 - - The number of students in this group # noqa: E501 - - :return: The users_count of this GroupDetails. # noqa: E501 - :rtype: float + The details of a group + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the group") + name: StrictStr = Field(description="The displayable name of the group") + type: GroupType + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization owning the group") + classroom: Optional[StrictStr] = Field(default=None, description="The unique identifier of the classroom owning the group. Only available for groups of type 'classStudentsSubGroup' or 'assignmentStudentsSubGroup'") + assignment: Optional[StrictStr] = Field(default=None, description="The unique identifier of the assignment owning the group. Only available for groups of type 'assignmentStudentsSubGroup'.") + parent: Optional[StrictStr] = Field(default=None, description="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.") + creation_date: datetime = Field(description="The date when the group was created", alias="creationDate") + users_count: Union[StrictFloat, StrictInt] = Field(description="The number of students in this group", alias="usersCount") + read_only: StrictBool = Field(description="`true` if the properties and members of this group are read-only ", alias="readOnly") + tags: List[StrictStr] = Field(description="Tags for categorizing groups. * `edu:testing-students`: Marks this group as containing test student accounts ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "type", "organization", "classroom", "assignment", "parent", "creationDate", "usersCount", "readOnly", "tags"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._users_count - - @users_count.setter - def users_count(self, users_count): - """Sets the users_count of this GroupDetails. - - The number of students in this group # noqa: E501 - - :param users_count: The users_count of this GroupDetails. # noqa: E501 - :type: float - """ - - self._users_count = users_count - - @property - def read_only(self): - """Gets the read_only of this GroupDetails. # noqa: E501 - - `true` if the properties and members of this group are in in read-only # noqa: E501 - - :return: The read_only of this GroupDetails. # noqa: E501 - :rtype: bool - """ - return self._read_only - - @read_only.setter - def read_only(self, read_only): - """Sets the read_only of this GroupDetails. - - `true` if the properties and members of this group are in in read-only # noqa: E501 - - :param read_only: The read_only of this GroupDetails. # noqa: E501 - :type: bool - """ - - self._read_only = read_only - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, GroupDetails): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "organization": obj.get("organization"), + "classroom": obj.get("classroom"), + "assignment": obj.get("assignment"), + "parent": obj.get("parent"), + "creationDate": obj.get("creationDate"), + "usersCount": obj.get("usersCount"), + "readOnly": obj.get("readOnly"), + "tags": obj.get("tags") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/group_type.py b/flat_api/models/group_type.py index fe5e0d2..5b6f4c1 100644 --- a/flat_api/models/group_type.py +++ b/flat_api/models/group_type.py @@ -3,89 +3,39 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class GroupType(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class GroupType(str, Enum): """ - allowed enum values + The type of the group: * `generic`: A group created by a Flat user * `classTeachers`: A group created automatically by Flat that contains the teachers of a class * `classStudents`: A group created automatically by Flat that contains the students of a class * `classStudentsSubGroup`: Manually created sub-group of students of a class. * `assignmentStudentsSubGroup`: Manually created Sub-group of students of a class, in relation to a specific assignment. """ - GENERIC = "generic" - CLASSTEACHERS = "classTeachers" - CLASSSTUDENTS = "classStudents" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """GroupType - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + GENERIC = 'generic' + CLASSTEACHERS = 'classTeachers' + CLASSSTUDENTS = 'classStudents' + CLASSSTUDENTSSUBGROUP = 'classStudentsSubGroup' + ASSIGNMENTSTUDENTSSUBGROUP = 'assignmentStudentsSubGroup' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, GroupType): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of GroupType from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/license_mode.py b/flat_api/models/license_mode.py index 0cd6d3b..33a7ae8 100644 --- a/flat_api/models/license_mode.py +++ b/flat_api/models/license_mode.py @@ -3,88 +3,36 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class LicenseMode(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class LicenseMode(str, Enum): """ - allowed enum values + Mode of the license """ - CREDIT = "credit" - SITE = "site" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """LicenseMode - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + CREDIT = 'credit' + SITE = 'site' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LicenseMode): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LicenseMode from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/license_sources.py b/flat_api/models/license_sources.py index 201687b..39e7617 100644 --- a/flat_api/models/license_sources.py +++ b/flat_api/models/license_sources.py @@ -3,91 +3,42 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class LicenseSources(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class LicenseSources(str, Enum): """ - allowed enum values + Source of the license """ - ORDER = "order" - TRIAL = "trial" - VOUCHER = "voucher" - DISTRIBUTOR = "distributor" - SUBSCRIPTION = "subscription" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """LicenseSources - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + ORDER = 'order' + TRIAL = 'trial' + VOUCHER = 'voucher' + DISTRIBUTOR = 'distributor' + SUBSCRIPTION = 'subscription' + APPSTORE = 'appStore' + PLAYSTORE = 'playStore' + MUSICFIRST = 'musicfirst' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LicenseSources): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LicenseSources from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/lms_name.py b/flat_api/models/lms_name.py index 36cb336..8c00a92 100644 --- a/flat_api/models/lms_name.py +++ b/flat_api/models/lms_name.py @@ -3,93 +3,42 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class LmsName(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class LmsName(str, Enum): """ - allowed enum values + LMS name """ - CANVAS = "canvas" - MOODLE = "moodle" - SCHOOLOGY = "schoology" - BLACKBOARD = "blackboard" - DESIRE2LEARN = "desire2learn" - SAKAI = "sakai" - OTHER = "other" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """LmsName - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + CANVAS = 'canvas' + MOODLE = 'moodle' + SCHOOLOGY = 'schoology' + BLACKBOARD = 'blackboard' + DESIRE2LEARN = 'desire2learn' + SAKAI = 'sakai' + SCHOOLBOX = 'schoolbox' + OTHER = 'other' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LmsName): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LmsName from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/lti_configuration.py b/flat_api/models/lti_configuration.py new file mode 100644 index 0000000..8b669be --- /dev/null +++ b/flat_api/models/lti_configuration.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.lti_configuration1p1 import LtiConfiguration1p1 +from flat_api.models.lti_configuration1p3 import LtiConfiguration1p3 +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATION_ONE_OF_SCHEMAS = ["LtiConfiguration1p1", "LtiConfiguration1p3"] + +class LtiConfiguration(BaseModel): + """ + LTI configuration details (unified 1.1 and 1.3) + """ + # data type: LtiConfiguration1p1 + oneof_schema_1_validator: Optional[LtiConfiguration1p1] = None + # data type: LtiConfiguration1p3 + oneof_schema_2_validator: Optional[LtiConfiguration1p3] = None + actual_instance: Optional[Union[LtiConfiguration1p1, LtiConfiguration1p3]] = None + one_of_schemas: Set[str] = { "LtiConfiguration1p1", "LtiConfiguration1p3" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfiguration.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfiguration1p1 + if not isinstance(v, LtiConfiguration1p1): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p1`") + else: + match += 1 + # validate data type: LtiConfiguration1p3 + if not isinstance(v, LtiConfiguration1p3): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfiguration1p1 + try: + instance.actual_instance = LtiConfiguration1p1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3 + try: + instance.actual_instance = LtiConfiguration1p3.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfiguration with oneOf schemas: LtiConfiguration1p1, LtiConfiguration1p3. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfiguration1p1, LtiConfiguration1p3]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/lti_configuration1p1.py b/flat_api/models/lti_configuration1p1.py new file mode 100644 index 0000000..1eef58a --- /dev/null +++ b/flat_api/models/lti_configuration1p1.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p1_all_of_tool import LtiConfiguration1p1AllOfTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p1(BaseModel): + """ + LtiConfiguration1p1 + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.1)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + consumer_key: Optional[StrictStr] = Field(default=None, description="LTI 1.1 consumer key", alias="consumerKey") + consumer_secret: Optional[StrictStr] = Field(default=None, description="LTI 1.1 consumer secret (only included for admins)", alias="consumerSecret") + lms: Optional[StrictStr] = Field(default=None, description="LMS type") + name: Optional[StrictStr] = Field(default=None, description="Configuration name") + tool: Optional[LtiConfiguration1p1AllOfTool] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "consumerKey", "consumerSecret", "lms", "name", "tool"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1']): + raise ValueError("must be one of enum values ('1p1')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "consumerKey": obj.get("consumerKey"), + "consumerSecret": obj.get("consumerSecret"), + "lms": obj.get("lms"), + "name": obj.get("name"), + "tool": LtiConfiguration1p1AllOfTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p1_all_of_tool.py b/flat_api/models/lti_configuration1p1_all_of_tool.py new file mode 100644 index 0000000..bc9fe46 --- /dev/null +++ b/flat_api/models/lti_configuration1p1_all_of_tool.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p1AllOfTool(BaseModel): + """ + Platform/tool product information + """ # noqa: E501 + product: Optional[StrictStr] = Field(default=None, description="Product family code (e.g., canvas, moodle, schoology)") + version: Optional[StrictStr] = Field(default=None, description="Platform version string") + instance_name: Optional[StrictStr] = Field(default=None, description="Instance display name", alias="instanceName") + instance_guid: Optional[StrictStr] = Field(default=None, description="Unique instance identifier", alias="instanceGuid") + instance_contact: Optional[StrictStr] = Field(default=None, description="Contact email or handle for the instance", alias="instanceContact") + instance_domain: Optional[StrictStr] = Field(default=None, description="Instance root domain", alias="instanceDomain") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["product", "version", "instanceName", "instanceGuid", "instanceContact", "instanceDomain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1AllOfTool from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p1AllOfTool from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "product": obj.get("product"), + "version": obj.get("version"), + "instanceName": obj.get("instanceName"), + "instanceGuid": obj.get("instanceGuid"), + "instanceContact": obj.get("instanceContact"), + "instanceDomain": obj.get("instanceDomain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3.py b/flat_api/models/lti_configuration1p3.py new file mode 100644 index 0000000..0db38bc --- /dev/null +++ b/flat_api/models/lti_configuration1p3.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.lti_configuration1p3_deployment import LtiConfiguration1p3Deployment +from flat_api.models.lti_configuration1p3_dynamic import LtiConfiguration1p3Dynamic +from flat_api.models.lti_configuration1p3_manual import LtiConfiguration1p3Manual +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATION1P3_ONE_OF_SCHEMAS = ["LtiConfiguration1p3Deployment", "LtiConfiguration1p3Dynamic", "LtiConfiguration1p3Manual"] + +class LtiConfiguration1p3(BaseModel): + """ + LTI 1.3 configuration details + """ + # data type: LtiConfiguration1p3Manual + oneof_schema_1_validator: Optional[LtiConfiguration1p3Manual] = None + # data type: LtiConfiguration1p3Deployment + oneof_schema_2_validator: Optional[LtiConfiguration1p3Deployment] = None + # data type: LtiConfiguration1p3Dynamic + oneof_schema_3_validator: Optional[LtiConfiguration1p3Dynamic] = None + actual_instance: Optional[Union[LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual]] = None + one_of_schemas: Set[str] = { "LtiConfiguration1p3Deployment", "LtiConfiguration1p3Dynamic", "LtiConfiguration1p3Manual" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfiguration1p3.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfiguration1p3Manual + if not isinstance(v, LtiConfiguration1p3Manual): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Manual`") + else: + match += 1 + # validate data type: LtiConfiguration1p3Deployment + if not isinstance(v, LtiConfiguration1p3Deployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Deployment`") + else: + match += 1 + # validate data type: LtiConfiguration1p3Dynamic + if not isinstance(v, LtiConfiguration1p3Dynamic): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfiguration1p3Dynamic`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfiguration1p3Manual + try: + instance.actual_instance = LtiConfiguration1p3Manual.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3Deployment + try: + instance.actual_instance = LtiConfiguration1p3Deployment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfiguration1p3Dynamic + try: + instance.actual_instance = LtiConfiguration1p3Dynamic.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfiguration1p3 with oneOf schemas: LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfiguration1p3Deployment, LtiConfiguration1p3Dynamic, LtiConfiguration1p3Manual]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/lti_configuration1p3_base.py b/flat_api/models/lti_configuration1p3_base.py new file mode 100644 index 0000000..8534571 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base.py @@ -0,0 +1,158 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Base(BaseModel): + """ + LtiConfiguration1p3Base + """ # noqa: E501 + mode: Optional[StrictStr] = Field(default=None, description="LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-manual', '1p3-deployment', '1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-manual', '1p3-deployment', '1p3-dynamic')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Base from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Base from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_base_supported_services.py b/flat_api/models/lti_configuration1p3_base_supported_services.py new file mode 100644 index 0000000..4e50fe1 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base_supported_services.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p3_base_supported_services_ags import LtiConfiguration1p3BaseSupportedServicesAgs +from flat_api.models.lti_configuration1p3_base_supported_services_deep_linking import LtiConfiguration1p3BaseSupportedServicesDeepLinking +from flat_api.models.lti_configuration1p3_base_supported_services_nrps import LtiConfiguration1p3BaseSupportedServicesNrps +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServices(BaseModel): + """ + LTI services support information + """ # noqa: E501 + ags: Optional[LtiConfiguration1p3BaseSupportedServicesAgs] = None + nrps: Optional[LtiConfiguration1p3BaseSupportedServicesNrps] = None + deep_linking: Optional[LtiConfiguration1p3BaseSupportedServicesDeepLinking] = Field(default=None, alias="deepLinking") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ags", "nrps", "deepLinking"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServices from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ags + if self.ags: + _dict['ags'] = self.ags.to_dict() + # override the default output from pydantic by calling `to_dict()` of nrps + if self.nrps: + _dict['nrps'] = self.nrps.to_dict() + # override the default output from pydantic by calling `to_dict()` of deep_linking + if self.deep_linking: + _dict['deepLinking'] = self.deep_linking.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServices from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ags": LtiConfiguration1p3BaseSupportedServicesAgs.from_dict(obj["ags"]) if obj.get("ags") is not None else None, + "nrps": LtiConfiguration1p3BaseSupportedServicesNrps.from_dict(obj["nrps"]) if obj.get("nrps") is not None else None, + "deepLinking": LtiConfiguration1p3BaseSupportedServicesDeepLinking.from_dict(obj["deepLinking"]) if obj.get("deepLinking") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_base_supported_services_ags.py b/flat_api/models/lti_configuration1p3_base_supported_services_ags.py new file mode 100644 index 0000000..644a272 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base_supported_services_ags.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesAgs(BaseModel): + """ + Assignment and Grade Services support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether AGS claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="AGS version supported (e.g., \"2.0\")") + enabled: Optional[StrictBool] = Field(default=None, description="Whether AGS is enabled for this platform") + lineitems_url: Optional[StrictStr] = Field(default=None, description="Base URL for line items operations as provided by the platform", alias="lineitemsUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version", "enabled", "lineitemsUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesAgs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version"), + "enabled": obj.get("enabled"), + "lineitemsUrl": obj.get("lineitemsUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_base_supported_services_deep_linking.py b/flat_api/models/lti_configuration1p3_base_supported_services_deep_linking.py new file mode 100644 index 0000000..ca16b82 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base_supported_services_deep_linking.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesDeepLinking(BaseModel): + """ + Deep Linking support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether Deep Linking claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="Deep Linking version supported (e.g., \"2.0\")") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesDeepLinking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_base_supported_services_nrps.py b/flat_api/models/lti_configuration1p3_base_supported_services_nrps.py new file mode 100644 index 0000000..5601cf4 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base_supported_services_nrps.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseSupportedServicesNrps(BaseModel): + """ + Names and Role Provisioning Services support + """ # noqa: E501 + available: Optional[StrictBool] = Field(default=None, description="Whether NRPS claims were detected in launches from this platform") + version: Optional[StrictStr] = Field(default=None, description="NRPS version supported (e.g., \"2.0\")") + enabled: Optional[StrictBool] = Field(default=None, description="Whether NRPS is enabled for this platform") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "version", "enabled"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseSupportedServicesNrps from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "version": obj.get("version"), + "enabled": obj.get("enabled") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_base_tool.py b/flat_api/models/lti_configuration1p3_base_tool.py new file mode 100644 index 0000000..bcecd7c --- /dev/null +++ b/flat_api/models/lti_configuration1p3_base_tool.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3BaseTool(BaseModel): + """ + Platform/tool product information + """ # noqa: E501 + product: Optional[StrictStr] = Field(default=None, description="Product family code (e.g., canvas, moodle, schoology)") + version: Optional[StrictStr] = Field(default=None, description="Platform version string") + instance_name: Optional[StrictStr] = Field(default=None, description="Instance name (e.g., 'My University Canvas')", alias="instanceName") + instance_guid: Optional[StrictStr] = Field(default=None, description="Unique instance identifier", alias="instanceGuid") + instance_contact: Optional[StrictStr] = Field(default=None, description="Contact email or handle for the instance", alias="instanceContact") + instance_domain: Optional[StrictStr] = Field(default=None, description="Instance root domain", alias="instanceDomain") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["product", "version", "instanceName", "instanceGuid", "instanceContact", "instanceDomain"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseTool from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3BaseTool from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "product": obj.get("product"), + "version": obj.get("version"), + "instanceName": obj.get("instanceName"), + "instanceGuid": obj.get("instanceGuid"), + "instanceContact": obj.get("instanceContact"), + "instanceDomain": obj.get("instanceDomain") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_deployment.py b/flat_api/models/lti_configuration1p3_deployment.py new file mode 100644 index 0000000..44714b1 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_deployment.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Deployment(BaseModel): + """ + LtiConfiguration1p3Deployment + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Deployment-based LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + parent_id: Optional[StrictStr] = Field(default=None, description="Parent configuration ID (for deployment-based configs)", alias="parentId") + deployment_key: Optional[StrictStr] = Field(default=None, description="Deployment key (e.g., schoology, classlink)", alias="deploymentKey") + deployment_breakdown_by: Optional[StrictStr] = Field(default=None, description="Custom claim used for tenant identification (parent platforms only, read-only)", alias="deploymentBreakdownBy") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Value of the custom claim that identifies this specific tenant (child platforms only)", alias="deploymentBreakdownId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching", "parentId", "deploymentKey", "deploymentBreakdownBy", "deploymentBreakdownId"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-deployment']): + raise ValueError("must be one of enum values ('1p3-deployment')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Deployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Deployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True, + "parentId": obj.get("parentId"), + "deploymentKey": obj.get("deploymentKey"), + "deploymentBreakdownBy": obj.get("deploymentBreakdownBy"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_dynamic.py b/flat_api/models/lti_configuration1p3_dynamic.py new file mode 100644 index 0000000..2d77103 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_dynamic.py @@ -0,0 +1,205 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Dynamic(BaseModel): + """ + LtiConfiguration1p3Dynamic + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Dynamic registration LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + registration_token: Optional[StrictStr] = Field(default=None, description="Only included for admins", alias="registrationToken") + registration_url: Optional[StrictStr] = Field(default=None, description="Dynamic registration URL (only included for admins when available)", alias="registrationUrl") + registration_token_used: Optional[StrictBool] = Field(default=None, description="Whether dynamic registration token has been used", alias="registrationTokenUsed") + registration_completion_date: Optional[datetime] = Field(default=None, description="Date when dynamic registration completed (null when not completed)", alias="registrationCompletionDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching", "registrationToken", "registrationUrl", "registrationTokenUsed", "registrationCompletionDate"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-dynamic')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Dynamic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if registration_completion_date (nullable) is None + # and model_fields_set contains the field + if self.registration_completion_date is None and "registration_completion_date" in self.model_fields_set: + _dict['registrationCompletionDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Dynamic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True, + "registrationToken": obj.get("registrationToken"), + "registrationUrl": obj.get("registrationUrl"), + "registrationTokenUsed": obj.get("registrationTokenUsed"), + "registrationCompletionDate": obj.get("registrationCompletionDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration1p3_manual.py b/flat_api/models/lti_configuration1p3_manual.py new file mode 100644 index 0000000..84b5a99 --- /dev/null +++ b/flat_api/models/lti_configuration1p3_manual.py @@ -0,0 +1,192 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration1p3_base_supported_services import LtiConfiguration1p3BaseSupportedServices +from flat_api.models.lti_configuration1p3_base_tool import LtiConfiguration1p3BaseTool +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfiguration1p3Manual(BaseModel): + """ + LtiConfiguration1p3Manual + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version (1.3)", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + mode: Optional[StrictStr] = Field(default=None, description="Manual LTI 1.3 configuration mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment ID linking the tool to a tenant/class (varies by platform)", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="OAuth2 token endpoint (for AGS/NRPS)", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="OIDC authorization/login endpoint", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint (public keys)", alias="jwksUrl") + deployment_mode: Optional[StrictStr] = Field(default=None, description="Deployment mode (single for organization-specific, multi for shared parent platforms)", alias="deploymentMode") + supported_services: Optional[LtiConfiguration1p3BaseSupportedServices] = Field(default=None, alias="supportedServices") + tool: Optional[LtiConfiguration1p3BaseTool] = None + public_keyset_url: Optional[StrictStr] = Field(default=None, description="Public keyset URL for the platform to retrieve Flat's public keys", alias="publicKeysetUrl") + initiate_login_url: Optional[StrictStr] = Field(default=None, description="URL for the platform to initiate LTI login", alias="initiateLoginUrl") + redirect_uris: Optional[List[StrictStr]] = Field(default=None, description="Allowed redirect URIs for LTI launches", alias="redirectUris") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status", "mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "deploymentMode", "supportedServices", "tool", "publicKeysetUrl", "initiateLoginUrl", "redirectUris", "enableEmailMatching"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3']): + raise ValueError("must be one of enum values ('1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['1p3-manual']): + raise ValueError("must be one of enum values ('1p3-manual')") + return value + + @field_validator('deployment_mode') + def deployment_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['single', 'multi']): + raise ValueError("must be one of enum values ('single', 'multi')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Manual from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of supported_services + if self.supported_services: + _dict['supportedServices'] = self.supported_services.to_dict() + # override the default output from pydantic by calling `to_dict()` of tool + if self.tool: + _dict['tool'] = self.tool.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfiguration1p3Manual from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status"), + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "deploymentMode": obj.get("deploymentMode"), + "supportedServices": LtiConfiguration1p3BaseSupportedServices.from_dict(obj["supportedServices"]) if obj.get("supportedServices") is not None else None, + "tool": LtiConfiguration1p3BaseTool.from_dict(obj["tool"]) if obj.get("tool") is not None else None, + "publicKeysetUrl": obj.get("publicKeysetUrl"), + "initiateLoginUrl": obj.get("initiateLoginUrl"), + "redirectUris": obj.get("redirectUris"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_base.py b/flat_api/models/lti_configuration_base.py new file mode 100644 index 0000000..16a176c --- /dev/null +++ b/flat_api/models/lti_configuration_base.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationBase(BaseModel): + """ + LtiConfigurationBase + """ # noqa: E501 + id: StrictStr = Field(description="Configuration ID") + lti_version: StrictStr = Field(description="LTI version", alias="ltiVersion") + organization_id: Optional[StrictStr] = Field(default=None, description="Organization ID", alias="organizationId") + organization_name: Optional[StrictStr] = Field(default=None, description="Organization name", alias="organizationName") + creator_id: Optional[StrictStr] = Field(default=None, description="ID of the user who created this configuration", alias="creatorId") + creation_date: datetime = Field(description="Configuration creation date", alias="creationDate") + last_used_date: Optional[datetime] = Field(default=None, description="Last time this configuration was used", alias="lastUsedDate") + status: Optional[StrictStr] = Field(default=None, description="Configuration status indicator") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "ltiVersion", "organizationId", "organizationName", "creatorId", "creationDate", "lastUsedDate", "status"] + + @field_validator('lti_version') + def lti_version_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1', '1p3']): + raise ValueError("must be one of enum values ('1p1', '1p3')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ready-to-use', 'in-use', 'incomplete-setup']): + raise ValueError("must be one of enum values ('ready-to-use', 'in-use', 'incomplete-setup')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if last_used_date (nullable) is None + # and model_fields_set contains the field + if self.last_used_date is None and "last_used_date" in self.model_fields_set: + _dict['lastUsedDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ltiVersion": obj.get("ltiVersion"), + "organizationId": obj.get("organizationId"), + "organizationName": obj.get("organizationName"), + "creatorId": obj.get("creatorId"), + "creationDate": obj.get("creationDate"), + "lastUsedDate": obj.get("lastUsedDate"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_create.py b/flat_api/models/lti_configuration_create.py new file mode 100644 index 0000000..fd6af7b --- /dev/null +++ b/flat_api/models/lti_configuration_create.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.lti_configuration_create1p1 import LtiConfigurationCreate1p1 +from flat_api.models.lti_configuration_create1p3_deployment import LtiConfigurationCreate1p3Deployment +from flat_api.models.lti_configuration_create1p3_dynamic import LtiConfigurationCreate1p3Dynamic +from flat_api.models.lti_configuration_create1p3_manual import LtiConfigurationCreate1p3Manual +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +LTICONFIGURATIONCREATE_ONE_OF_SCHEMAS = ["LtiConfigurationCreate1p1", "LtiConfigurationCreate1p3Deployment", "LtiConfigurationCreate1p3Dynamic", "LtiConfigurationCreate1p3Manual"] + +class LtiConfigurationCreate(BaseModel): + """ + Request to create a new LTI configuration (unified 1.1 and 1.3) + """ + # data type: LtiConfigurationCreate1p1 + oneof_schema_1_validator: Optional[LtiConfigurationCreate1p1] = None + # data type: LtiConfigurationCreate1p3Dynamic + oneof_schema_2_validator: Optional[LtiConfigurationCreate1p3Dynamic] = None + # data type: LtiConfigurationCreate1p3Deployment + oneof_schema_3_validator: Optional[LtiConfigurationCreate1p3Deployment] = None + # data type: LtiConfigurationCreate1p3Manual + oneof_schema_4_validator: Optional[LtiConfigurationCreate1p3Manual] = None + actual_instance: Optional[Union[LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual]] = None + one_of_schemas: Set[str] = { "LtiConfigurationCreate1p1", "LtiConfigurationCreate1p3Deployment", "LtiConfigurationCreate1p3Dynamic", "LtiConfigurationCreate1p3Manual" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = LtiConfigurationCreate.model_construct() + error_messages = [] + match = 0 + # validate data type: LtiConfigurationCreate1p1 + if not isinstance(v, LtiConfigurationCreate1p1): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p1`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Dynamic + if not isinstance(v, LtiConfigurationCreate1p3Dynamic): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Dynamic`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Deployment + if not isinstance(v, LtiConfigurationCreate1p3Deployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Deployment`") + else: + match += 1 + # validate data type: LtiConfigurationCreate1p3Manual + if not isinstance(v, LtiConfigurationCreate1p3Manual): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationCreate1p3Manual`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LtiConfigurationCreate1p1 + try: + instance.actual_instance = LtiConfigurationCreate1p1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Dynamic + try: + instance.actual_instance = LtiConfigurationCreate1p3Dynamic.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Deployment + try: + instance.actual_instance = LtiConfigurationCreate1p3Deployment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into LtiConfigurationCreate1p3Manual + try: + instance.actual_instance = LtiConfigurationCreate1p3Manual.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfigurationCreate with oneOf schemas: LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfigurationCreate1p1, LtiConfigurationCreate1p3Deployment, LtiConfigurationCreate1p3Dynamic, LtiConfigurationCreate1p3Manual]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/lti_configuration_create1p1.py b/flat_api/models/lti_configuration_create1p1.py new file mode 100644 index 0000000..98df1f5 --- /dev/null +++ b/flat_api/models/lti_configuration_create1p1.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p1(BaseModel): + """ + LTI 1.1 manual configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.1 manual creation mode") + name: Optional[StrictStr] = Field(default=None, description="Display name for LTI 1.1 credentials") + lms: Optional[StrictStr] = Field(default=None, description="LMS identifier for LTI 1.1 credentials") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "name", "lms"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p1-manual']): + raise ValueError("must be one of enum values ('1p1-manual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "name": obj.get("name"), + "lms": obj.get("lms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_create1p3_deployment.py b/flat_api/models/lti_configuration_create1p3_deployment.py new file mode 100644 index 0000000..096a8e2 --- /dev/null +++ b/flat_api/models/lti_configuration_create1p3_deployment.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Deployment(BaseModel): + """ + LTI 1.3 deployment-based configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 deployment-based creation mode") + deployment_type: StrictStr = Field(description="Parent platform key (e.g., blackboard, schoology, classlink, manabipocket, manabipocket-stg)", alias="deploymentType") + deployment_id: StrictStr = Field(description="Deployment identifier provided by the platform", alias="deploymentId") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id for the tenant; required for ClassLink deployments", alias="clientId") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Value of the custom claim that identifies this specific tenant (for multi-tenant platforms like Schoology)", alias="deploymentBreakdownId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "deploymentType", "deploymentId", "clientId", "deploymentBreakdownId"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-deployment']): + raise ValueError("must be one of enum values ('1p3-deployment')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Deployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Deployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "deploymentType": obj.get("deploymentType"), + "deploymentId": obj.get("deploymentId"), + "clientId": obj.get("clientId"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_create1p3_dynamic.py b/flat_api/models/lti_configuration_create1p3_dynamic.py new file mode 100644 index 0000000..748f292 --- /dev/null +++ b/flat_api/models/lti_configuration_create1p3_dynamic.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lti_configuration_create1p3_dynamic_platform_info import LtiConfigurationCreate1p3DynamicPlatformInfo +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Dynamic(BaseModel): + """ + LTI 1.3 dynamic registration configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 dynamic registration mode") + platform_info: Optional[LtiConfigurationCreate1p3DynamicPlatformInfo] = Field(default=None, alias="platformInfo") + locale: Optional[StrictStr] = Field(default=None, description="Optional locale code for registration URL. Input values will be automatically normalized to a supported locale code.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformInfo", "locale"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-dynamic']): + raise ValueError("must be one of enum values ('1p3-dynamic')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Dynamic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of platform_info + if self.platform_info: + _dict['platformInfo'] = self.platform_info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Dynamic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformInfo": LtiConfigurationCreate1p3DynamicPlatformInfo.from_dict(obj["platformInfo"]) if obj.get("platformInfo") is not None else None, + "locale": obj.get("locale") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_create1p3_dynamic_platform_info.py b/flat_api/models/lti_configuration_create1p3_dynamic_platform_info.py new file mode 100644 index 0000000..9f04a3b --- /dev/null +++ b/flat_api/models/lti_configuration_create1p3_dynamic_platform_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3DynamicPlatformInfo(BaseModel): + """ + Optional platform information for dynamic registration + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Platform display name") + url: Optional[StrictStr] = Field(default=None, description="Optional platform homepage or admin URL for reference") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3DynamicPlatformInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "url": obj.get("url") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_create1p3_manual.py b/flat_api/models/lti_configuration_create1p3_manual.py new file mode 100644 index 0000000..63300a4 --- /dev/null +++ b/flat_api/models/lti_configuration_create1p3_manual.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationCreate1p3Manual(BaseModel): + """ + LTI 1.3 manual configuration creation + """ # noqa: E501 + mode: StrictStr = Field(description="LTI 1.3 manual creation mode") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + access_token_url: Optional[StrictStr] = Field(default=None, description="Platform access token endpoint URL", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="Platform OIDC authorization endpoint URL", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint URL for public keys", alias="jwksUrl") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mode", "platformIss", "platformName", "clientId", "deploymentId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "enableEmailMatching"] + + @field_validator('mode') + def mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1p3-manual']): + raise ValueError("must be one of enum values ('1p3-manual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Manual from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationCreate1p3Manual from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "deploymentId": obj.get("deploymentId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_update.py b/flat_api/models/lti_configuration_update.py new file mode 100644 index 0000000..3a7e632 --- /dev/null +++ b/flat_api/models/lti_configuration_update.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from flat_api.models.lti_configuration_update_deployment import LtiConfigurationUpdateDeployment +from flat_api.models.lti_configuration_update_standalone import LtiConfigurationUpdateStandalone +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LTICONFIGURATIONUPDATE_ANY_OF_SCHEMAS = ["LtiConfigurationUpdateDeployment", "LtiConfigurationUpdateStandalone"] + +class LtiConfigurationUpdate(BaseModel): + """ + Update an existing LTI 1.3 configuration (deployment clone or standalone) + """ + + # data type: LtiConfigurationUpdateDeployment + anyof_schema_1_validator: Optional[LtiConfigurationUpdateDeployment] = None + # data type: LtiConfigurationUpdateStandalone + anyof_schema_2_validator: Optional[LtiConfigurationUpdateStandalone] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "LtiConfigurationUpdateDeployment", "LtiConfigurationUpdateStandalone" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LtiConfigurationUpdate.model_construct() + error_messages = [] + # validate data type: LtiConfigurationUpdateDeployment + if not isinstance(v, LtiConfigurationUpdateDeployment): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationUpdateDeployment`") + else: + return v + + # validate data type: LtiConfigurationUpdateStandalone + if not isinstance(v, LtiConfigurationUpdateStandalone): + error_messages.append(f"Error! Input type `{type(v)}` is not `LtiConfigurationUpdateStandalone`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LtiConfigurationUpdate with anyOf schemas: LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[LtiConfigurationUpdateDeployment] = None + try: + instance.actual_instance = LtiConfigurationUpdateDeployment.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[LtiConfigurationUpdateStandalone] = None + try: + instance.actual_instance = LtiConfigurationUpdateStandalone.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LtiConfigurationUpdate with anyOf schemas: LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LtiConfigurationUpdateDeployment, LtiConfigurationUpdateStandalone]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flat_api/models/lti_configuration_update_deployment.py b/flat_api/models/lti_configuration_update_deployment.py new file mode 100644 index 0000000..c0b327c --- /dev/null +++ b/flat_api/models/lti_configuration_update_deployment.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationUpdateDeployment(BaseModel): + """ + Update fields allowed for deployment-based configurations + """ # noqa: E501 + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + deployment_breakdown_id: Optional[StrictStr] = Field(default=None, description="Specific tenant identifier for multi-tenant platforms", alias="deploymentBreakdownId") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deploymentId", "deploymentBreakdownId", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateDeployment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateDeployment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deploymentId": obj.get("deploymentId"), + "deploymentBreakdownId": obj.get("deploymentBreakdownId"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_configuration_update_standalone.py b/flat_api/models/lti_configuration_update_standalone.py new file mode 100644 index 0000000..0b33294 --- /dev/null +++ b/flat_api/models/lti_configuration_update_standalone.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LtiConfigurationUpdateStandalone(BaseModel): + """ + Update fields allowed for standalone (manual/dynamic) configurations + """ # noqa: E501 + deployment_id: Optional[StrictStr] = Field(default=None, description="Deployment identifier provided by the platform", alias="deploymentId") + platform_iss: Optional[StrictStr] = Field(default=None, description="Platform issuer URL", alias="platformIss") + platform_name: Optional[StrictStr] = Field(default=None, description="Platform display name", alias="platformName") + client_id: Optional[StrictStr] = Field(default=None, description="OAuth2 client_id allocated by the platform", alias="clientId") + access_token_url: Optional[StrictStr] = Field(default=None, description="Platform access token endpoint URL", alias="accessTokenUrl") + authorization_url: Optional[StrictStr] = Field(default=None, description="Platform OIDC authorization endpoint URL", alias="authorizationUrl") + jwks_url: Optional[StrictStr] = Field(default=None, description="Platform JWKS endpoint URL for public keys", alias="jwksUrl") + enable_email_matching: Optional[StrictBool] = Field(default=None, description="Enable email-based user matching during LTI authentication", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deploymentId", "platformIss", "platformName", "clientId", "accessTokenUrl", "authorizationUrl", "jwksUrl", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateStandalone from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiConfigurationUpdateStandalone from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deploymentId": obj.get("deploymentId"), + "platformIss": obj.get("platformIss"), + "platformName": obj.get("platformName"), + "clientId": obj.get("clientId"), + "accessTokenUrl": obj.get("accessTokenUrl"), + "authorizationUrl": obj.get("authorizationUrl"), + "jwksUrl": obj.get("jwksUrl"), + "enableEmailMatching": obj.get("enableEmailMatching") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/lti_credentials.py b/flat_api/models/lti_credentials.py index 5661a1c..b32e75d 100644 --- a/flat_api/models/lti_credentials.py +++ b/flat_api/models/lti_credentials.py @@ -3,336 +3,120 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.lms_name import LmsName # noqa: F401,E501 +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.lms_name import LmsName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class LtiCredentials(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class LtiCredentials(BaseModel): """ + A pair of LTI 1.1 OAuth credentials + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of this pair of credentials") + name: Optional[StrictStr] = Field(default=None, description="Name of the pair of credentials") + lms: Optional[LmsName] = None + organization: Optional[StrictStr] = Field(default=None, description="The unique identifier of the Organization associated to these credentials") + creator: Optional[StrictStr] = Field(default=None, description="Unique identifier of the user who created these credentials") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of these credentials", alias="creationDate") + last_usage: Optional[datetime] = Field(default=None, description="The last time these credentials were used", alias="lastUsage") + consumer_key: Optional[StrictStr] = Field(default=None, description="OAuth 1 Consumer Key", alias="consumerKey") + consumer_secret: Optional[StrictStr] = Field(default=None, description="OAuth 1 Consumer Secret", alias="consumerSecret") + enable_email_matching: Optional[StrictBool] = Field(default=True, description="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. ", alias="enableEmailMatching") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "lms", "organization", "creator", "creationDate", "lastUsage", "consumerKey", "consumerSecret", "enableEmailMatching"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiCredentials from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiCredentials from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "lms": obj.get("lms"), + "organization": obj.get("organization"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "lastUsage": obj.get("lastUsage"), + "consumerKey": obj.get("consumerKey"), + "consumerSecret": obj.get("consumerSecret"), + "enableEmailMatching": obj.get("enableEmailMatching") if obj.get("enableEmailMatching") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'name': 'str', - 'lms': 'LmsName', - 'organization': 'str', - 'creator': 'str', - 'creation_date': 'datetime', - 'last_usage': 'datetime', - 'consumer_key': 'str', - 'consumer_secret': 'str' - } - - attribute_map = { - 'id': 'id', - 'name': 'name', - 'lms': 'lms', - 'organization': 'organization', - 'creator': 'creator', - 'creation_date': 'creationDate', - 'last_usage': 'lastUsage', - 'consumer_key': 'consumerKey', - 'consumer_secret': 'consumerSecret' - } - - def __init__(self, id=None, name=None, lms=None, organization=None, creator=None, creation_date=None, last_usage=None, consumer_key=None, consumer_secret=None): # noqa: E501 - """LtiCredentials - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._name = None - self._lms = None - self._organization = None - self._creator = None - self._creation_date = None - self._last_usage = None - self._consumer_key = None - self._consumer_secret = None - self.discriminator = None - - if id is not None: - self.id = id - if name is not None: - self.name = name - if lms is not None: - self.lms = lms - if organization is not None: - self.organization = organization - if creator is not None: - self.creator = creator - if creation_date is not None: - self.creation_date = creation_date - if last_usage is not None: - self.last_usage = last_usage - if consumer_key is not None: - self.consumer_key = consumer_key - if consumer_secret is not None: - self.consumer_secret = consumer_secret - - @property - def id(self): - """Gets the id of this LtiCredentials. # noqa: E501 - - The unique identifier of this couple of credentials # noqa: E501 - - :return: The id of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this LtiCredentials. - - The unique identifier of this couple of credentials # noqa: E501 - - :param id: The id of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def name(self): - """Gets the name of this LtiCredentials. # noqa: E501 - - Name of the couple of credentials # noqa: E501 - - :return: The name of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this LtiCredentials. - - Name of the couple of credentials # noqa: E501 - - :param name: The name of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def lms(self): - """Gets the lms of this LtiCredentials. # noqa: E501 - - - :return: The lms of this LtiCredentials. # noqa: E501 - :rtype: LmsName - """ - return self._lms - - @lms.setter - def lms(self, lms): - """Sets the lms of this LtiCredentials. - - - :param lms: The lms of this LtiCredentials. # noqa: E501 - :type: LmsName - """ - - self._lms = lms - - @property - def organization(self): - """Gets the organization of this LtiCredentials. # noqa: E501 - - The unique identifier of the Organization associated to these credentials # noqa: E501 - - :return: The organization of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this LtiCredentials. - - The unique identifier of the Organization associated to these credentials # noqa: E501 - - :param organization: The organization of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def creator(self): - """Gets the creator of this LtiCredentials. # noqa: E501 - - Unique identifier of the user who created these credentials # noqa: E501 - - :return: The creator of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._creator - - @creator.setter - def creator(self, creator): - """Sets the creator of this LtiCredentials. - - Unique identifier of the user who created these credentials # noqa: E501 - - :param creator: The creator of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._creator = creator - - @property - def creation_date(self): - """Gets the creation_date of this LtiCredentials. # noqa: E501 - - The creation date of thse credentials # noqa: E501 - - :return: The creation_date of this LtiCredentials. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this LtiCredentials. - - The creation date of thse credentials # noqa: E501 - - :param creation_date: The creation_date of this LtiCredentials. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def last_usage(self): - """Gets the last_usage of this LtiCredentials. # noqa: E501 - - The last time these credentials were used # noqa: E501 - - :return: The last_usage of this LtiCredentials. # noqa: E501 - :rtype: datetime - """ - return self._last_usage - - @last_usage.setter - def last_usage(self, last_usage): - """Sets the last_usage of this LtiCredentials. - - The last time these credentials were used # noqa: E501 - - :param last_usage: The last_usage of this LtiCredentials. # noqa: E501 - :type: datetime - """ - - self._last_usage = last_usage - - @property - def consumer_key(self): - """Gets the consumer_key of this LtiCredentials. # noqa: E501 - - OAuth 1 Consumer Key # noqa: E501 - - :return: The consumer_key of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._consumer_key - - @consumer_key.setter - def consumer_key(self, consumer_key): - """Sets the consumer_key of this LtiCredentials. - - OAuth 1 Consumer Key # noqa: E501 - - :param consumer_key: The consumer_key of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._consumer_key = consumer_key - - @property - def consumer_secret(self): - """Gets the consumer_secret of this LtiCredentials. # noqa: E501 - - OAuth 1 Consumer Secret # noqa: E501 - - :return: The consumer_secret of this LtiCredentials. # noqa: E501 - :rtype: str - """ - return self._consumer_secret - - @consumer_secret.setter - def consumer_secret(self, consumer_secret): - """Sets the consumer_secret of this LtiCredentials. - - OAuth 1 Consumer Secret # noqa: E501 - - :param consumer_secret: The consumer_secret of this LtiCredentials. # noqa: E501 - :type: str - """ - - self._consumer_secret = consumer_secret - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LtiCredentials): - return False - - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/lti_credentials_creation.py b/flat_api/models/lti_credentials_creation.py index 6f11b79..5852dd5 100644 --- a/flat_api/models/lti_credentials_creation.py +++ b/flat_api/models/lti_credentials_creation.py @@ -3,144 +3,104 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.lms_name import LmsName # noqa: F401,E501 - - -class LtiCredentialsCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from flat_api.models.lms_name import LmsName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class LtiCredentialsCreation(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'str', - 'lms': 'LmsName' - } - - attribute_map = { - 'name': 'name', - 'lms': 'lms' - } - - def __init__(self, name=None, lms=None): # noqa: E501 - """LtiCredentialsCreation - a model defined in Swagger""" # noqa: E501 - - self._name = None - self._lms = None - self.discriminator = None - - self.name = name - self.lms = lms - - @property - def name(self): - """Gets the name of this LtiCredentialsCreation. # noqa: E501 - - Name of the couple of credentials # noqa: E501 - - :return: The name of this LtiCredentialsCreation. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this LtiCredentialsCreation. - - Name of the couple of credentials # noqa: E501 - - :param name: The name of this LtiCredentialsCreation. # noqa: E501 - :type: str + Creation of a pair of LTI 1.1 OAuth credentials + """ # noqa: E501 + name: Annotated[str, Field(strict=True, max_length=300)] = Field(description="Name of the pair of credentials") + lms: LmsName + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "lms"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LtiCredentialsCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - if name is not None and len(name) > 300: - raise ValueError("Invalid value for `name`, length must be less than or equal to `300`") # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LtiCredentialsCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "lms": obj.get("lms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._name = name - @property - def lms(self): - """Gets the lms of this LtiCredentialsCreation. # noqa: E501 - - - :return: The lms of this LtiCredentialsCreation. # noqa: E501 - :rtype: LmsName - """ - return self._lms - - @lms.setter - def lms(self, lms): - """Sets the lms of this LtiCredentialsCreation. - - - :param lms: The lms of this LtiCredentialsCreation. # noqa: E501 - :type: LmsName - """ - if lms is None: - raise ValueError("Invalid value for `lms`, must not be `None`") # noqa: E501 - - self._lms = lms - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LtiCredentialsCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/media_attachment.py b/flat_api/models/media_attachment.py index 76f3b96..6242e05 100644 --- a/flat_api/models/media_attachment.py +++ b/flat_api/models/media_attachment.py @@ -3,538 +3,154 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode # noqa: F401,E501 - - -class MediaAttachment(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class MediaAttachment(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'type': 'str', - 'score': 'str', - 'revision': 'str', - 'correct': 'bool', - 'sharing_mode': 'MediaScoreSharingMode', - 'title': 'str', - 'description': 'str', - 'html': 'str', - 'html_width': 'str', - 'html_height': 'str', - 'url': 'str', - 'thumbnail_url': 'str', - 'thumbnail_width': 'str', - 'thumbnail_height': 'str', - 'author_name': 'str', - 'author_url': 'str' - } - - attribute_map = { - 'type': 'type', - 'score': 'score', - 'revision': 'revision', - 'correct': 'correct', - 'sharing_mode': 'sharingMode', - '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' - } - - def __init__(self, type=None, score=None, revision=None, correct=None, sharing_mode=None, title=None, description=None, html=None, html_width=None, html_height=None, url=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None, author_name=None, author_url=None): # noqa: E501 - """MediaAttachment - a model defined in Swagger""" # noqa: E501 - - self._type = None - self._score = None - self._revision = None - self._correct = None - self._sharing_mode = None - self._title = None - self._description = None - self._html = None - self._html_width = None - self._html_height = None - self._url = None - self._thumbnail_url = None - self._thumbnail_width = None - self._thumbnail_height = None - self._author_name = None - self._author_url = None - self.discriminator = None - - if type is not None: - self.type = type - if score is not None: - self.score = score - if revision is not None: - self.revision = revision - if correct is not None: - self.correct = correct - if sharing_mode is not None: - self.sharing_mode = sharing_mode - if title is not None: - self.title = title - if description is not None: - self.description = description - if html is not None: - self.html = html - if html_width is not None: - self.html_width = html_width - if html_height is not None: - self.html_height = html_height - if url is not None: - self.url = url - if thumbnail_url is not None: - self.thumbnail_url = thumbnail_url - if thumbnail_width is not None: - self.thumbnail_width = thumbnail_width - if thumbnail_height is not None: - self.thumbnail_height = thumbnail_height - if author_name is not None: - self.author_name = author_name - if author_url is not None: - self.author_url = author_url - - @property - def type(self): - """Gets the type of this MediaAttachment. # noqa: E501 - - 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. # noqa: E501 - - :return: The type of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this MediaAttachment. - - 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. # noqa: E501 - - :param type: The type of this MediaAttachment. # noqa: E501 - :type: str - """ - allowed_values = ["rich", "photo", "video", "link", "flat", "exercise"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def score(self): - """Gets the score of this MediaAttachment. # noqa: E501 - - An unique Flat score identifier # noqa: E501 - - :return: The score of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._score - - @score.setter - def score(self, score): - """Sets the score of this MediaAttachment. - - An unique Flat score identifier # noqa: E501 - - :param score: The score of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._score = score - - @property - def revision(self): - """Gets the revision of this MediaAttachment. # noqa: E501 - - An unique revision identifier of a score # noqa: E501 - - :return: The revision of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._revision - - @revision.setter - def revision(self, revision): - """Sets the revision of this MediaAttachment. - - An unique revision identifier of a score # noqa: E501 - - :param revision: The revision of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._revision = revision - - @property - def correct(self): - """Gets the correct of this MediaAttachment. # noqa: E501 - - If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only. # noqa: E501 - - :return: The correct of this MediaAttachment. # noqa: E501 - :rtype: bool - """ - return self._correct - - @correct.setter - def correct(self, correct): - """Sets the correct of this MediaAttachment. - - If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only. # noqa: E501 - - :param correct: The correct of this MediaAttachment. # noqa: E501 - :type: bool - """ - - self._correct = correct - - @property - def sharing_mode(self): - """Gets the sharing_mode of this MediaAttachment. # noqa: E501 - - - :return: The sharing_mode of this MediaAttachment. # noqa: E501 - :rtype: MediaScoreSharingMode - """ - return self._sharing_mode - - @sharing_mode.setter - def sharing_mode(self, sharing_mode): - """Sets the sharing_mode of this MediaAttachment. - - - :param sharing_mode: The sharing_mode of this MediaAttachment. # noqa: E501 - :type: MediaScoreSharingMode - """ - - self._sharing_mode = sharing_mode - - @property - def title(self): - """Gets the title of this MediaAttachment. # noqa: E501 - - The resolved title of the attachment # noqa: E501 - - :return: The title of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this MediaAttachment. - - The resolved title of the attachment # noqa: E501 - - :param title: The title of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def description(self): - """Gets the description of this MediaAttachment. # noqa: E501 - - The resolved description of the attachment # noqa: E501 - - :return: The description of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this MediaAttachment. - - The resolved description of the attachment # noqa: E501 - - :param description: The description of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def html(self): - """Gets the html of this MediaAttachment. # noqa: E501 - - If the attachment type is `rich` or `video`, the HTML code of the media to display # noqa: E501 - - :return: The html of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._html - - @html.setter - def html(self, html): - """Sets the html of this MediaAttachment. - - If the attachment type is `rich` or `video`, the HTML code of the media to display # noqa: E501 - - :param html: The html of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._html = html - - @property - def html_width(self): - """Gets the html_width of this MediaAttachment. # noqa: E501 - - If the `html` is available, the width of the widget # noqa: E501 - - :return: The html_width of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._html_width - - @html_width.setter - def html_width(self, html_width): - """Sets the html_width of this MediaAttachment. - - If the `html` is available, the width of the widget # noqa: E501 - - :param html_width: The html_width of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._html_width = html_width - - @property - def html_height(self): - """Gets the html_height of this MediaAttachment. # noqa: E501 - - If the `html` is available, the height of the widget # noqa: E501 - - :return: The html_height of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._html_height - - @html_height.setter - def html_height(self, html_height): - """Sets the html_height of this MediaAttachment. - - If the `html` is available, the height of the widget # noqa: E501 - - :param html_height: The html_height of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._html_height = html_height - - @property - def url(self): - """Gets the url of this MediaAttachment. # noqa: E501 - - The url of the attachment # noqa: E501 - - :return: The url of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this MediaAttachment. - - The url of the attachment # noqa: E501 - - :param url: The url of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._url = url - - @property - def thumbnail_url(self): - """Gets the thumbnail_url of this MediaAttachment. # noqa: E501 - - If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment # noqa: E501 - - :return: The thumbnail_url of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._thumbnail_url - - @thumbnail_url.setter - def thumbnail_url(self, thumbnail_url): - """Sets the thumbnail_url of this MediaAttachment. - - If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment # noqa: E501 - - :param thumbnail_url: The thumbnail_url of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._thumbnail_url = thumbnail_url - - @property - def thumbnail_width(self): - """Gets the thumbnail_width of this MediaAttachment. # noqa: E501 - - If the `thumbnailUrl` is available, the width of the thumbnail # noqa: E501 - - :return: The thumbnail_width of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._thumbnail_width - - @thumbnail_width.setter - def thumbnail_width(self, thumbnail_width): - """Sets the thumbnail_width of this MediaAttachment. - - If the `thumbnailUrl` is available, the width of the thumbnail # noqa: E501 - - :param thumbnail_width: The thumbnail_width of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._thumbnail_width = thumbnail_width - - @property - def thumbnail_height(self): - """Gets the thumbnail_height of this MediaAttachment. # noqa: E501 - - If the `thumbnailUrl` is available, the width of the thumbnail # noqa: E501 - - :return: The thumbnail_height of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._thumbnail_height - - @thumbnail_height.setter - def thumbnail_height(self, thumbnail_height): - """Sets the thumbnail_height of this MediaAttachment. - - If the `thumbnailUrl` is available, the width of the thumbnail # noqa: E501 - - :param thumbnail_height: The thumbnail_height of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._thumbnail_height = thumbnail_height - - @property - def author_name(self): - """Gets the author_name of this MediaAttachment. # noqa: E501 - - The resolved author name of the attachment # noqa: E501 - - :return: The author_name of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._author_name - - @author_name.setter - def author_name(self, author_name): - """Sets the author_name of this MediaAttachment. - - The resolved author name of the attachment # noqa: E501 - - :param author_name: The author_name of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._author_name = author_name - - @property - def author_url(self): - """Gets the author_url of this MediaAttachment. # noqa: E501 - - The resolved author url of the attachment # noqa: E501 - - :return: The author_url of this MediaAttachment. # noqa: E501 - :rtype: str - """ - return self._author_url - - @author_url.setter - def author_url(self, author_url): - """Sets the author_url of this MediaAttachment. - - The resolved author url of the attachment # noqa: E501 - - :param author_url: The author_url of this MediaAttachment. # noqa: E501 - :type: str - """ - - self._author_url = author_url - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MediaAttachment): - return False + Media attachment. The API will automatically resolve the details, oEmbed, and media available if possible and return them in this object + """ # noqa: E501 + type: StrictStr = Field(description="The resolved type of the attachment: * `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: Optional[StrictStr] = Field(default=None, description="A unique Flat score identifier") + revision: Optional[StrictStr] = Field(default=None, description="A unique revision identifier of a score") + worksheet: Optional[StrictStr] = Field(default=None, description="A unique worksheet identifier") + dedicated: Optional[StrictBool] = Field(default=None, description="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") + track: Optional[StrictStr] = Field(default=None, description="A unique track identifier") + part_uuid: Optional[StrictStr] = Field(default=None, description="The UUID of the instrument part selected for this attachment (for performance submissions)", alias="partUuid") + sharing_mode: Optional[MediaScoreSharingMode] = Field(default=MediaScoreSharingMode.READ, alias="sharingMode") + lock_score_template: Optional[StrictBool] = Field(default=None, description="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.", alias="lockScoreTemplate") + title: Optional[StrictStr] = Field(default=None, description="The resolved title of the attachment") + description: Optional[StrictStr] = Field(default=None, description="The resolved description of the attachment") + html: Optional[StrictStr] = Field(default=None, description="If the attachment type is `rich` or `video`, the HTML code of the media to display ") + html_width: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If the `html` is available, the width of the widget", alias="htmlWidth") + html_height: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="If the `html` is available, the height of the widget", alias="htmlHeight") + url: Optional[StrictStr] = Field(default=None, description="The url of the attachment") + thumbnail_url: Optional[StrictStr] = Field(default=None, description="If the attachment type is `rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment ", alias="thumbnailUrl") + thumbnail_width: Optional[StrictInt] = Field(default=None, description="If the `thumbnailUrl` is available, the width of the thumbnail ", alias="thumbnailWidth") + thumbnail_height: Optional[StrictInt] = Field(default=None, description="If the `thumbnailUrl` is available, the height of the thumbnail ", alias="thumbnailHeight") + author_name: Optional[StrictStr] = Field(default=None, description="The resolved author name of the attachment", alias="authorName") + author_url: Optional[StrictStr] = Field(default=None, description="The resolved author url of the attachment", alias="authorUrl") + icon_url: Optional[StrictStr] = Field(default=None, description="The URL of the icon", alias="iconUrl") + mime_type: Optional[StrictStr] = Field(default=None, description="The MIME type of the file", alias="mimeType") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="The ID of the Google Drive File", alias="googleDriveFileId") + teacher_only: Optional[StrictBool] = Field(default=False, description="If true, this attachment is only visible to teachers. When students view the assignment, attachments with this flag will be filtered out. ", alias="teacherOnly") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "score", "revision", "worksheet", "dedicated", "track", "partUuid", "sharingMode", "lockScoreTemplate", "title", "description", "html", "htmlWidth", "htmlHeight", "url", "thumbnailUrl", "thumbnailWidth", "thumbnailHeight", "authorName", "authorUrl", "iconUrl", "mimeType", "googleDriveFileId", "teacherOnly"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet']): + raise ValueError("must be one of enum values ('rich', 'photo', 'video', 'link', 'flat', 'googleDrive', 'worksheet')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MediaAttachment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MediaAttachment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "worksheet": obj.get("worksheet"), + "dedicated": obj.get("dedicated"), + "track": obj.get("track"), + "partUuid": obj.get("partUuid"), + "sharingMode": obj.get("sharingMode") if obj.get("sharingMode") is not None else MediaScoreSharingMode.READ, + "lockScoreTemplate": obj.get("lockScoreTemplate"), + "title": obj.get("title"), + "description": obj.get("description"), + "html": obj.get("html"), + "htmlWidth": obj.get("htmlWidth"), + "htmlHeight": obj.get("htmlHeight"), + "url": obj.get("url"), + "thumbnailUrl": obj.get("thumbnailUrl"), + "thumbnailWidth": obj.get("thumbnailWidth"), + "thumbnailHeight": obj.get("thumbnailHeight"), + "authorName": obj.get("authorName"), + "authorUrl": obj.get("authorUrl"), + "iconUrl": obj.get("iconUrl"), + "mimeType": obj.get("mimeType"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "teacherOnly": obj.get("teacherOnly") if obj.get("teacherOnly") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/media_score_sharing_mode.py b/flat_api/models/media_score_sharing_mode.py index 0e183ce..b93c5fb 100644 --- a/flat_api/models/media_score_sharing_mode.py +++ b/flat_api/models/media_score_sharing_mode.py @@ -3,89 +3,38 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class MediaScoreSharingMode(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class MediaScoreSharingMode(str, Enum): """ - allowed enum values + The sharing mode of the score for classes post and assignments """ - READ = "read" - WRITE = "write" - COPY = "copy" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """MediaScoreSharingMode - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + READ = 'read' + WRITE = 'write' + COPY = 'copy' + PERFORMANCE = 'performance' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MediaScoreSharingMode): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MediaScoreSharingMode from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/microsoft_graph_assignment.py b/flat_api/models/microsoft_graph_assignment.py new file mode 100644 index 0000000..f0d46c0 --- /dev/null +++ b/flat_api/models/microsoft_graph_assignment.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MicrosoftGraphAssignment(BaseModel): + """ + A Microsoft Teams assignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifier of the assignment assigned by Microsoft Teams") + state: Optional[StrictStr] = Field(default=None, description="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 ") + alternate_link: Optional[StrictStr] = Field(default=None, description="Absolute link to this assignment in the Microsoft Teams web UI", alias="alternateLink") + assign_date_time: Optional[datetime] = Field(default=None, description="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. ", alias="assignDateTime") + categories: Optional[List[StrictStr]] = Field(default=None, description="List of categories where this assignment is published under") + assign_to_type: Optional[StrictStr] = Field(default=None, description="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 ", alias="assignToType") + assigned_students_ms_ids: Optional[List[StrictStr]] = Field(default=None, description="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. ", alias="assignedStudentsMsIds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state", "alternateLink", "assignDateTime", "categories", "assignToType", "assignedStudentsMsIds"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['draft', 'scheduled', 'published', 'assigned', 'inactive']): + raise ValueError("must be one of enum values ('draft', 'scheduled', 'published', 'assigned', 'inactive')") + return value + + @field_validator('assign_to_type') + def assign_to_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['class', 'individual']): + raise ValueError("must be one of enum values ('class', 'individual')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MicrosoftGraphAssignment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MicrosoftGraphAssignment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state"), + "alternateLink": obj.get("alternateLink"), + "assignDateTime": obj.get("assignDateTime"), + "categories": obj.get("categories"), + "assignToType": obj.get("assignToType"), + "assignedStudentsMsIds": obj.get("assignedStudentsMsIds") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/microsoft_graph_submission.py b/flat_api/models/microsoft_graph_submission.py new file mode 100644 index 0000000..49bf08f --- /dev/null +++ b/flat_api/models/microsoft_graph_submission.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MicrosoftGraphSubmission(BaseModel): + """ + A Microsoft Teams submission + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of the submission assigned by Microsoft Teams") + state: StrictStr = Field(description="State of the submission") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "state"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MicrosoftGraphSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MicrosoftGraphSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "state": obj.get("state") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_capabilities.py b/flat_api/models/omr_capabilities.py new file mode 100644 index 0000000..6114e47 --- /dev/null +++ b/flat_api/models/omr_capabilities.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.omr_job_output import OmrJobOutput +from flat_api.models.omr_locale_details import OmrLocaleDetails +from flat_api.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrCapabilities(BaseModel): + """ + What the account or app can do, for client feature-detection. + """ # noqa: E501 + steps: List[OmrStepName] = Field(description="Interactive steps this server supports.") + formats: List[StrictStr] = Field(description="Export formats available via `getOmrJobExport`.") + outputs: List[OmrJobOutput] = Field(description="Output destinations the account can use when creating a job.") + max_files: StrictInt = Field(description="Maximum number of input files that can be added to a single job.", alias="maxFiles") + max_pages: StrictInt = Field(description="Maximum number of pages allowed across all input files of a single job.", alias="maxPages") + max_parallel_jobs: StrictInt = Field(description="Maximum number of OMR jobs that can run in parallel for this account.", alias="maxParallelJobs") + max_file_size: StrictInt = Field(description="Maximum size of a single file, in bytes.", alias="maxFileSize") + accepted_mime_types: List[StrictStr] = Field(description="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. ", alias="acceptedMimeTypes") + accepted_extensions: List[StrictStr] = Field(description="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. ", alias="acceptedExtensions") + cost_per_page: Optional[StrictInt] = Field(default=None, description="Credits charged per page.", alias="costPerPage") + remaining_credits: Optional[StrictInt] = Field(default=None, description="OMR credits remaining for the account.", alias="remainingCredits") + retention_days: Optional[StrictInt] = Field(default=None, description="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. ", alias="retentionDays") + locales: List[StrictStr] = Field(description="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: List[OmrLocaleDetails] = Field(description="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. ", alias="localesDetails") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["steps", "formats", "outputs", "maxFiles", "maxPages", "maxParallelJobs", "maxFileSize", "acceptedMimeTypes", "acceptedExtensions", "costPerPage", "remainingCredits", "retentionDays", "locales", "localesDetails"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrCapabilities from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in locales_details (list) + _items = [] + if self.locales_details: + for _item_locales_details in self.locales_details: + if _item_locales_details: + _items.append(_item_locales_details.to_dict()) + _dict['localesDetails'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrCapabilities from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "steps": obj.get("steps"), + "formats": obj.get("formats"), + "outputs": obj.get("outputs"), + "maxFiles": obj.get("maxFiles"), + "maxPages": obj.get("maxPages"), + "maxParallelJobs": obj.get("maxParallelJobs"), + "maxFileSize": obj.get("maxFileSize"), + "acceptedMimeTypes": obj.get("acceptedMimeTypes"), + "acceptedExtensions": obj.get("acceptedExtensions"), + "costPerPage": obj.get("costPerPage"), + "remainingCredits": obj.get("remainingCredits"), + "retentionDays": obj.get("retentionDays"), + "locales": obj.get("locales"), + "localesDetails": [OmrLocaleDetails.from_dict(_item) for _item in obj["localesDetails"]] if obj.get("localesDetails") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_details_step_data.py b/flat_api/models/omr_details_step_data.py new file mode 100644 index 0000000..14f5b93 --- /dev/null +++ b/flat_api/models/omr_details_step_data.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.omr_detected_instrument import OmrDetectedInstrument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetailsStepData(BaseModel): + """ + Detected score details for the client to review before the score is built. `title` and `instruments` are detected from the input; the language is not detected and is not part of this payload (read the job's `locales`, set at creation). + """ # noqa: E501 + step: StrictStr = Field(description="Discriminator for `OmrPendingStep.data`; always `details` for this payload.") + title: Optional[StrictStr] = Field(default=None, description="OCR-detected work title.") + instruments: List[OmrDetectedInstrument] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["step", "title", "instruments"] + + @field_validator('step') + def step_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['details']): + raise ValueError("must be one of enum values ('details')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetailsStepData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetailsStepData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "title": obj.get("title"), + "instruments": [OmrDetectedInstrument.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_details_submission.py b/flat_api/models/omr_details_submission.py new file mode 100644 index 0000000..2804ac6 --- /dev/null +++ b/flat_api/models/omr_details_submission.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.omr_instrument_override import OmrInstrumentOverride +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetailsSubmission(BaseModel): + """ + Overrides for the `details` step. Omitted fields keep the server's detected values. + """ # noqa: E501 + step: StrictStr = Field(description="Discriminator for `OmrStepSubmission`; always `details` for this submission.") + title: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="Override the detected work title.") + main_language: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=35)]] = Field(default=None, description="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. ", alias="mainLanguage") + instruments: Optional[Annotated[List[OmrInstrumentOverride], Field(max_length=200)]] = Field(default=None, description="Per-part overrides, each matched to a detected part by `index`.") + __properties: ClassVar[List[str]] = ["step", "title", "mainLanguage", "instruments"] + + @field_validator('step') + def step_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['details']): + raise ValueError("must be one of enum values ('details')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetailsSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetailsSubmission from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "title": obj.get("title"), + "mainLanguage": obj.get("mainLanguage"), + "instruments": [OmrInstrumentOverride.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + return _obj + + diff --git a/flat_api/models/omr_detected_instrument.py b/flat_api/models/omr_detected_instrument.py new file mode 100644 index 0000000..027d32d --- /dev/null +++ b/flat_api/models/omr_detected_instrument.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrDetectedInstrument(BaseModel): + """ + One detected part. + """ # noqa: E501 + index: StrictInt = Field(description="0-based position of the part in the score.") + part_name: Optional[StrictStr] = Field(default=None, description="Verbatim part name read from the score.", alias="partName") + instrument_id: Optional[StrictStr] = Field(default=None, description="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.", alias="instrumentId") + instrument_name: Optional[StrictStr] = Field(default=None, description="Localized display name, resolved server-side so the client needs no instruments dictionary.", alias="instrumentName") + midi_program: Optional[StrictInt] = Field(default=None, description="General MIDI program number.", alias="midiProgram") + transpose_key: Optional[StrictStr] = Field(default=None, description="Transposition or written key shown in the UI, for example `F` for Horn in F.", alias="transposeKey") + resolved_confidence: Optional[StrictStr] = Field(default=None, description="Server confidence in the resolved instrument match.", alias="resolvedConfidence") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "partName", "instrumentId", "instrumentName", "midiProgram", "transposeKey", "resolvedConfidence"] + + @field_validator('resolved_confidence') + def resolved_confidence_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['high', 'medium', 'low']): + raise ValueError("must be one of enum values ('high', 'medium', 'low')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrDetectedInstrument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrDetectedInstrument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "partName": obj.get("partName"), + "instrumentId": obj.get("instrumentId"), + "instrumentName": obj.get("instrumentName"), + "midiProgram": obj.get("midiProgram"), + "transposeKey": obj.get("transposeKey"), + "resolvedConfidence": obj.get("resolvedConfidence") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_imported_metadata.py b/flat_api/models/omr_imported_metadata.py new file mode 100644 index 0000000..e63d5b9 --- /dev/null +++ b/flat_api/models/omr_imported_metadata.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrImportedMetadata(BaseModel): + """ + Metadata extracted from the recognized score. + """ # noqa: E501 + instruments: Optional[List[StrictStr]] = Field(default=None, description="Instrument IDs of the assembled parts.") + number_measures: Optional[StrictInt] = Field(default=None, description="Number of measures in the recognized score.", alias="numberMeasures") + main_tempo_qpm: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Main tempo, in quarter notes per minute.", alias="mainTempoQpm") + main_key_signature: Optional[StrictInt] = Field(default=None, description="Main key signature as a fifths count (negative for flats, positive for sharps, 0 for C major / A minor).", alias="mainKeySignature") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["instruments", "numberMeasures", "mainTempoQpm", "mainKeySignature"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrImportedMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrImportedMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "instruments": obj.get("instruments"), + "numberMeasures": obj.get("numberMeasures"), + "mainTempoQpm": obj.get("mainTempoQpm"), + "mainKeySignature": obj.get("mainKeySignature") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_instrument_override.py b/flat_api/models/omr_instrument_override.py new file mode 100644 index 0000000..2f343b6 --- /dev/null +++ b/flat_api/models/omr_instrument_override.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrInstrumentOverride(BaseModel): + """ + Override for a single detected part, matched by `index`. Omitted fields keep the detected value. To set the instrument you may use **either** `instrumentId` (Flat's instrument id) **or** `midiProgram` (a standard General MIDI program) — whichever your integration prefers; you do not need both. If both are sent, `instrumentId` wins; otherwise `midiProgram` is resolved to the matching instrument; otherwise the detected instrument is kept. `transposeKey` and `partName` apply independently on top. + """ # noqa: E501 + index: Annotated[int, Field(strict=True, ge=0)] = Field(description="0-based position of the part to override, matching the `index` of the detected part.") + instrument_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = Field(default=None, description="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. ", alias="instrumentId") + part_name: Optional[Annotated[str, Field(strict=True, max_length=200)]] = Field(default=None, description="Override the part name.", alias="partName") + transpose_key: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="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`. ", alias="transposeKey") + midi_program: Optional[Annotated[int, Field(le=127, strict=True, ge=0)]] = Field(default=None, description="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. ", alias="midiProgram") + __properties: ClassVar[List[str]] = ["index", "instrumentId", "partName", "transposeKey", "midiProgram"] + + @field_validator('transpose_key', mode="before") + def transpose_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^[A-G][b♭#♯]?$", value): + raise ValueError(r"must validate the regular expression /^[A-G][b♭#♯]?$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrInstrumentOverride from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrInstrumentOverride from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "instrumentId": obj.get("instrumentId"), + "partName": obj.get("partName"), + "transposeKey": obj.get("transposeKey"), + "midiProgram": obj.get("midiProgram") + }) + return _obj + + diff --git a/flat_api/models/omr_job.py b/flat_api/models/omr_job.py new file mode 100644 index 0000000..e5c287b --- /dev/null +++ b/flat_api/models/omr_job.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.omr_imported_metadata import OmrImportedMetadata +from flat_api.models.omr_job_file_metadata import OmrJobFileMetadata +from flat_api.models.omr_job_output import OmrJobOutput +from flat_api.models.omr_job_progress import OmrJobProgress +from flat_api.models.omr_job_result import OmrJobResult +from flat_api.models.omr_job_retention import OmrJobRetention +from flat_api.models.omr_job_status import OmrJobStatus +from flat_api.models.omr_pending_step import OmrPendingStep +from flat_api.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJob(BaseModel): + """ + OmrJob + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the OMR job.") + status: OmrJobStatus + output: OmrJobOutput + interactive_steps: List[OmrStepName] = Field(description="Steps this job pauses at for client input, echoing the value set at creation.", alias="interactiveSteps") + auto_rotate: Optional[StrictBool] = Field(default=None, description="Whether the job was created with `autoRotate`, echoing the value set at creation.", alias="autoRotate") + locales: Optional[List[StrictStr]] = Field(default=None, description="Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the `details` step. ") + current_step: Optional[OmrStepName] = Field(default=None, description="The pending step when `status` is `awaitingInput`. Omitted otherwise.", alias="currentStep") + pending_step: Optional[OmrPendingStep] = Field(default=None, alias="pendingStep") + estimated_credits: Optional[StrictInt] = Field(default=None, description="Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging.", alias="estimatedCredits") + progress: Optional[OmrJobProgress] = None + original_file_metadata: Optional[OmrJobFileMetadata] = Field(default=None, alias="originalFileMetadata") + imported_metadata: Optional[OmrImportedMetadata] = Field(default=None, alias="importedMetadata") + result: Optional[OmrJobResult] = None + retention: Optional[OmrJobRetention] = None + error_code: Optional[StrictStr] = Field(default=None, description="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. ", alias="errorCode") + error_message: Optional[StrictStr] = Field(default=None, description="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. ", alias="errorMessage") + creation_date: Optional[datetime] = Field(default=None, description="When the job was created.", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="When the job was last updated.", alias="modificationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "output", "interactiveSteps", "autoRotate", "locales", "currentStep", "pendingStep", "estimatedCredits", "progress", "originalFileMetadata", "importedMetadata", "result", "retention", "errorCode", "errorMessage", "creationDate", "modificationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJob from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pending_step + if self.pending_step: + _dict['pendingStep'] = self.pending_step.to_dict() + # override the default output from pydantic by calling `to_dict()` of progress + if self.progress: + _dict['progress'] = self.progress.to_dict() + # override the default output from pydantic by calling `to_dict()` of original_file_metadata + if self.original_file_metadata: + _dict['originalFileMetadata'] = self.original_file_metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of imported_metadata + if self.imported_metadata: + _dict['importedMetadata'] = self.imported_metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of retention + if self.retention: + _dict['retention'] = self.retention.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJob from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "output": obj.get("output") if obj.get("output") is not None else OmrJobOutput.LIBRARY, + "interactiveSteps": obj.get("interactiveSteps"), + "autoRotate": obj.get("autoRotate"), + "locales": obj.get("locales"), + "currentStep": obj.get("currentStep"), + "pendingStep": OmrPendingStep.from_dict(obj["pendingStep"]) if obj.get("pendingStep") is not None else None, + "estimatedCredits": obj.get("estimatedCredits"), + "progress": OmrJobProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None, + "originalFileMetadata": OmrJobFileMetadata.from_dict(obj["originalFileMetadata"]) if obj.get("originalFileMetadata") is not None else None, + "importedMetadata": OmrImportedMetadata.from_dict(obj["importedMetadata"]) if obj.get("importedMetadata") is not None else None, + "result": OmrJobResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "retention": OmrJobRetention.from_dict(obj["retention"]) if obj.get("retention") is not None else None, + "errorCode": obj.get("errorCode"), + "errorMessage": obj.get("errorMessage"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_creation.py b/flat_api/models/omr_job_creation.py new file mode 100644 index 0000000..5a876f5 --- /dev/null +++ b/flat_api/models/omr_job_creation.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.omr_job_input_file import OmrJobInputFile +from flat_api.models.omr_job_output import OmrJobOutput +from flat_api.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobCreation(BaseModel): + """ + Parameters to create an OMR job. Send without `files` to create a draft (then add files with `addOmrJobFile` and run `startOmrJob`), or include `files` and `autoStart: true` to import in a single request. + """ # noqa: E501 + output: Optional[OmrJobOutput] = OmrJobOutput.LIBRARY + interactive_steps: Optional[List[OmrStepName]] = Field(default=None, description="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. ", alias="interactiveSteps") + auto_rotate: Optional[StrictBool] = Field(default=False, description="Let the server detect and correct pages uploaded sideways or upside down (90/180/270°) before recognition. Off by default: pages are recognized in the orientation they are uploaded in, which is the right choice when your client lets the user rotate pages before upload. Enable it when it does not, for example a server-to-server integration importing scans as they come. Small tilt correction (a few degrees) always runs. ", alias="autoRotate") + locales: Optional[List[StrictStr]] = Field(default=None, description="Locale hints (BCP 47) to improve text and lyric detection, for example `[\"ja\", \"en\"]`. The first entry is the primary reading language. This is the input hint; the main language can be confirmed or corrected at the `details` step. ") + collection: Optional[StrictStr] = Field(default=None, description="Target collection ID. Only used when `output` is `library`.") + idempotency_key: Optional[StrictStr] = Field(default=None, description="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. ", alias="idempotencyKey") + files: Optional[List[OmrJobInputFile]] = Field(default=None, description="Optional inline inputs for a one-shot import. For multi-image or mobile capture, omit this and use `addOmrJobFile`.") + auto_start: Optional[StrictBool] = Field(default=None, description="Start processing immediately. Only valid when `files` is provided.", alias="autoStart") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["output", "interactiveSteps", "autoRotate", "locales", "collection", "idempotencyKey", "files", "autoStart"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item_files in self.files: + if _item_files: + _items.append(_item_files.to_dict()) + _dict['files'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "output": obj.get("output") if obj.get("output") is not None else OmrJobOutput.LIBRARY, + "interactiveSteps": obj.get("interactiveSteps"), + "autoRotate": obj.get("autoRotate") if obj.get("autoRotate") is not None else False, + "locales": obj.get("locales"), + "collection": obj.get("collection"), + "idempotencyKey": obj.get("idempotencyKey"), + "files": [OmrJobInputFile.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None, + "autoStart": obj.get("autoStart") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_file_metadata.py b/flat_api/models/omr_job_file_metadata.py new file mode 100644 index 0000000..3b90d24 --- /dev/null +++ b/flat_api/models/omr_job_file_metadata.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileMetadata(BaseModel): + """ + Metadata about the uploaded input. + """ # noqa: E501 + number_of_pages: Optional[StrictInt] = Field(default=None, description="Total number of pages across all input files.", alias="numberOfPages") + file_count: Optional[StrictInt] = Field(default=None, description="Number of input files attached.", alias="fileCount") + filename: Optional[StrictStr] = Field(default=None, description="Original filename of the input as uploaded (of the first file when several were combined).") + file_size: Optional[StrictInt] = Field(default=None, description="Combined size of the input files, in bytes.", alias="fileSize") + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the input (of the first file when several were combined).", alias="mimeType") + file_extension: Optional[StrictStr] = Field(default=None, description="File extension of the input, without the leading dot (for example `pdf`).", alias="fileExtension") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["numberOfPages", "fileCount", "filename", "fileSize", "mimeType", "fileExtension"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "numberOfPages": obj.get("numberOfPages"), + "fileCount": obj.get("fileCount"), + "filename": obj.get("filename"), + "fileSize": obj.get("fileSize"), + "mimeType": obj.get("mimeType"), + "fileExtension": obj.get("fileExtension") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_file_upload.py b/flat_api/models/omr_job_file_upload.py new file mode 100644 index 0000000..423a2b0 --- /dev/null +++ b/flat_api/models/omr_job_file_upload.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileUpload(BaseModel): + """ + One image or PDF added to a draft job. + """ # noqa: E501 + file: Union[StrictBytes, StrictStr] = Field(description="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: Optional[StrictStr] = Field(default=None, description="Optional original filename, kept for display.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["file", "filename"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileUpload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileUpload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file": obj.get("file"), + "filename": obj.get("filename") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_file_upload_result.py b/flat_api/models/omr_job_file_upload_result.py new file mode 100644 index 0000000..6af4c91 --- /dev/null +++ b/flat_api/models/omr_job_file_upload_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobFileUploadResult(BaseModel): + """ + Result of adding a file to a draft job. + """ # noqa: E501 + file_index: Optional[StrictInt] = Field(default=None, description="0-based index assigned to the uploaded file.", alias="fileIndex") + file_count: Optional[StrictInt] = Field(default=None, description="Total number of files now attached to the job.", alias="fileCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["fileIndex", "fileCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobFileUploadResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobFileUploadResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fileIndex": obj.get("fileIndex"), + "fileCount": obj.get("fileCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_input_file.py b/flat_api/models/omr_job_input_file.py new file mode 100644 index 0000000..30f9d53 --- /dev/null +++ b/flat_api/models/omr_job_input_file.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobInputFile(BaseModel): + """ + A single image or PDF input, base64-encoded. + """ # noqa: E501 + file: Union[StrictBytes, StrictStr] = Field(description="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: Optional[StrictStr] = Field(default=None, description="Optional original filename, kept for display.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["file", "filename"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobInputFile from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobInputFile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file": obj.get("file"), + "filename": obj.get("filename") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_output.py b/flat_api/models/omr_job_output.py new file mode 100644 index 0000000..04bebd2 --- /dev/null +++ b/flat_api/models/omr_job_output.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrJobOutput(str, Enum): + """ + Where the result of the job goes. * `library`: import the result into the Flat Library and create a score (default). * `musicxml`: finalize the result only, downloadable via `getOmrJobExport`. No score is created, for third-party integrations that do not use the Library. + """ + + """ + allowed enum values + """ + LIBRARY = 'library' + MUSICXML = 'musicxml' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrJobOutput from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/omr_job_progress.py b/flat_api/models/omr_job_progress.py new file mode 100644 index 0000000..2fa6849 --- /dev/null +++ b/flat_api/models/omr_job_progress.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobProgress(BaseModel): + """ + Live progress while the job is processing. + """ # noqa: E501 + percent: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Completion percentage (0-100).") + text: Optional[StrictStr] = Field(default=None, description="Localized progress message, ready to display.") + key: Optional[StrictStr] = Field(default=None, description="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. ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["percent", "text", "key"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobProgress from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobProgress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "percent": obj.get("percent"), + "text": obj.get("text"), + "key": obj.get("key") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_result.py b/flat_api/models/omr_job_result.py new file mode 100644 index 0000000..1e9c0e9 --- /dev/null +++ b/flat_api/models/omr_job_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobResult(BaseModel): + """ + The outcome of a finished job. Present when `status` is `done`. + """ # noqa: E501 + score: Optional[StrictStr] = Field(default=None, description="Created score ID, when `output` is `library`.") + exports: Optional[List[StrictStr]] = Field(default=None, description="Formats available via `getOmrJobExport`, for example `[\"musicxml\", \"mxl\", \"midi\"]`.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["score", "exports"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "exports": obj.get("exports") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_retention.py b/flat_api/models/omr_job_retention.py new file mode 100644 index 0000000..d52a97f --- /dev/null +++ b/flat_api/models/omr_job_retention.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrJobRetention(BaseModel): + """ + Data-retention state of the job. Present only on jobs whose `output` is `musicxml`. Jobs imported into the Flat library are part of your library content, are not covered by this policy, and omit this object entirely. Erasure happens shortly after `expiryDate` rather than exactly on it. Plan for the deadline, not the instant. + """ # noqa: E501 + expiry_date: datetime = Field(description="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. ", alias="expiryDate") + expired_date: Optional[datetime] = Field(default=None, description="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`. ", alias="expiredDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["expiryDate", "expiredDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrJobRetention from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrJobRetention from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expiryDate": obj.get("expiryDate"), + "expiredDate": obj.get("expiredDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_job_status.py b/flat_api/models/omr_job_status.py new file mode 100644 index 0000000..b2111da --- /dev/null +++ b/flat_api/models/omr_job_status.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrJobStatus(str, Enum): + """ + Status of the job. * `draft`: created, files can still be added; not yet started or charged. * `processing`: the pipeline is running. * `awaitingInput`: paused on the `currentStep`, waiting for the client to submit it. * `done`: finished. See `result`. * `error`: failed. See `errorCode`. * `canceled`: canceled by the client. + """ + + """ + allowed enum values + """ + DRAFT = 'draft' + PROCESSING = 'processing' + AWAITINGINPUT = 'awaitingInput' + DONE = 'done' + ERROR = 'error' + CANCELED = 'canceled' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrJobStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/omr_locale_details.py b/flat_api/models/omr_locale_details.py new file mode 100644 index 0000000..5fedb51 --- /dev/null +++ b/flat_api/models/omr_locale_details.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrLocaleDetails(BaseModel): + """ + An OCR-selectable locale with its English name. + """ # noqa: E501 + code: StrictStr = Field(description="BCP 47 locale code. Always one of the codes listed in `locales`.", json_schema_extra={"examples": ["vi"]}) + name: StrictStr = Field(description="English name of the language, for display in a picker.", json_schema_extra={"examples": ["Vietnamese"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrLocaleDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrLocaleDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_pending_step.py b/flat_api/models/omr_pending_step.py new file mode 100644 index 0000000..b1fca50 --- /dev/null +++ b/flat_api/models/omr_pending_step.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from flat_api.models.omr_details_step_data import OmrDetailsStepData +from flat_api.models.omr_step_name import OmrStepName +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OmrPendingStep(BaseModel): + """ + The step currently awaiting client input. The `data` shape is keyed by `step`. + """ # noqa: E501 + step: OmrStepName + data: OmrDetailsStepData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["step", "data"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OmrPendingStep from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OmrPendingStep from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "step": obj.get("step"), + "data": OmrDetailsStepData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/omr_step_name.py b/flat_api/models/omr_step_name.py new file mode 100644 index 0000000..e1d3c90 --- /dev/null +++ b/flat_api/models/omr_step_name.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class OmrStepName(str, Enum): + """ + Interactive pipeline step. Forward-compatible: new values may be added over time. Only steps a client lists in `interactiveSteps` can pause that client's job; any step a client does not list (including future ones) is auto-resolved by the server. * `details`: confirm or adjust the detected title, main language and instruments before the score is built. Resuming from this step is fast: note recognition is already done and is not run again. + """ + + """ + allowed enum values + """ + DETAILS = 'details' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OmrStepName from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/organization_invitation.py b/flat_api/models/organization_invitation.py index 1384a92..1b12e76 100644 --- a/flat_api/models/organization_invitation.py +++ b/flat_api/models/organization_invitation.py @@ -3,280 +3,125 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 - - -class OrganizationInvitation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.organization_roles import OrganizationRoles +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class OrganizationInvitation(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'organization': 'str', - 'organization_role': 'OrganizationRoles', - 'custom_code': 'str', - 'email': 'str', - 'invited_by': 'str', - 'used_by': 'str' - } - - attribute_map = { - 'id': 'id', - 'organization': 'organization', - 'organization_role': 'organizationRole', - 'custom_code': 'customCode', - 'email': 'email', - 'invited_by': 'invitedBy', - 'used_by': 'usedBy' - } - - def __init__(self, id=None, organization=None, organization_role=None, custom_code=None, email=None, invited_by=None, used_by=None): # noqa: E501 - """OrganizationInvitation - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._organization = None - self._organization_role = None - self._custom_code = None - self._email = None - self._invited_by = None - self._used_by = None - self.discriminator = None - - if id is not None: - self.id = id - if organization is not None: - self.organization = organization - if organization_role is not None: - self.organization_role = organization_role - if custom_code is not None: - self.custom_code = custom_code - if email is not None: - self.email = email - if invited_by is not None: - self.invited_by = invited_by - if used_by is not None: - self.used_by = used_by - - @property - def id(self): - """Gets the id of this OrganizationInvitation. # noqa: E501 - - The invitation unique identifier # noqa: E501 - - :return: The id of this OrganizationInvitation. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this OrganizationInvitation. - - The invitation unique identifier # noqa: E501 - - :param id: The id of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def organization(self): - """Gets the organization of this OrganizationInvitation. # noqa: E501 - - The unique identifier of the Organization owning this class # noqa: E501 - - :return: The organization of this OrganizationInvitation. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this OrganizationInvitation. - - The unique identifier of the Organization owning this class # noqa: E501 - - :param organization: The organization of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def organization_role(self): - """Gets the organization_role of this OrganizationInvitation. # noqa: E501 - - - :return: The organization_role of this OrganizationInvitation. # noqa: E501 - :rtype: OrganizationRoles - """ - return self._organization_role - - @organization_role.setter - def organization_role(self, organization_role): - """Sets the organization_role of this OrganizationInvitation. - - - :param organization_role: The organization_role of this OrganizationInvitation. # noqa: E501 - :type: OrganizationRoles - """ - - self._organization_role = organization_role - - @property - def custom_code(self): - """Gets the custom_code of this OrganizationInvitation. # noqa: E501 - - Enrollment code to use when joining this organization # noqa: E501 - - :return: The custom_code of this OrganizationInvitation. # noqa: E501 - :rtype: str - """ - return self._custom_code - - @custom_code.setter - def custom_code(self, custom_code): - """Sets the custom_code of this OrganizationInvitation. - - Enrollment code to use when joining this organization # noqa: E501 - - :param custom_code: The custom_code of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._custom_code = custom_code - - @property - def email(self): - """Gets the email of this OrganizationInvitation. # noqa: E501 - - The email address this invitation was sent to # noqa: E501 - - :return: The email of this OrganizationInvitation. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this OrganizationInvitation. - - The email address this invitation was sent to # noqa: E501 - - :param email: The email of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def invited_by(self): - """Gets the invited_by of this OrganizationInvitation. # noqa: E501 - - The unique identifier of the User who created this invitation # noqa: E501 - - :return: The invited_by of this OrganizationInvitation. # noqa: E501 - :rtype: str + Details of an invitation to join an organization + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The invitation unique identifier") + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the invitation", alias="creationDate") + organization: StrictStr = Field(description="The unique identifier of the Organization this invitation belongs to") + organization_role: OrganizationRoles = Field(alias="organizationRole") + custom_code: Optional[StrictStr] = Field(description="Enrollment code to use when joining this organization", alias="customCode") + email: Optional[StrictStr] = Field(default=None, description="The email address this invitation was sent to") + invited_by: Optional[StrictStr] = Field(default=None, description="The unique identifier of the User who created this invitation", alias="invitedBy") + html_url: Optional[StrictStr] = Field(default=None, description="URL to join the organization using this invitation", alias="htmlUrl") + allow_multiple_use: StrictBool = Field(description="If true, the invitation can be used multiple times. If false, the invitation can only be used once. ", alias="allowMultipleUse") + used_by: Optional[List[StrictStr]] = Field(default=None, description="List of users who used this invitation", alias="usedBy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "creationDate", "organization", "organizationRole", "customCode", "email", "invitedBy", "htmlUrl", "allowMultipleUse", "usedBy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationInvitation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._invited_by - - @invited_by.setter - def invited_by(self, invited_by): - """Sets the invited_by of this OrganizationInvitation. - - The unique identifier of the User who created this invitation # noqa: E501 - - :param invited_by: The invited_by of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._invited_by = invited_by - - @property - def used_by(self): - """Gets the used_by of this OrganizationInvitation. # noqa: E501 - - The unique identifier of the User who used this invitation # noqa: E501 - - :return: The used_by of this OrganizationInvitation. # noqa: E501 - :rtype: str - """ - return self._used_by - - @used_by.setter - def used_by(self, used_by): - """Sets the used_by of this OrganizationInvitation. - - The unique identifier of the User who used this invitation # noqa: E501 - - :param used_by: The used_by of this OrganizationInvitation. # noqa: E501 - :type: str - """ - - self._used_by = used_by - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, OrganizationInvitation): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if custom_code (nullable) is None + # and model_fields_set contains the field + if self.custom_code is None and "custom_code" in self.model_fields_set: + _dict['customCode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationInvitation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "customCode": obj.get("customCode"), + "email": obj.get("email"), + "invitedBy": obj.get("invitedBy"), + "htmlUrl": obj.get("htmlUrl"), + "allowMultipleUse": obj.get("allowMultipleUse"), + "usedBy": obj.get("usedBy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/organization_invitation_creation.py b/flat_api/models/organization_invitation_creation.py index 60e6d44..7b79ed5 100644 --- a/flat_api/models/organization_invitation_creation.py +++ b/flat_api/models/organization_invitation_creation.py @@ -3,140 +3,112 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class OrganizationInvitationCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class OrganizationInvitationCreation(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'email': 'str', - 'organization_role': 'OrganizationRoles' - } - - attribute_map = { - 'email': 'email', - 'organization_role': 'organizationRole' - } - - def __init__(self, email=None, organization_role=None): # noqa: E501 - """OrganizationInvitationCreation - a model defined in Swagger""" # noqa: E501 - - self._email = None - self._organization_role = None - self.discriminator = None - - if email is not None: - self.email = email - if organization_role is not None: - self.organization_role = organization_role - - @property - def email(self): - """Gets the email of this OrganizationInvitationCreation. # noqa: E501 - - The email address you want to send the invitation to # noqa: E501 - - :return: The email of this OrganizationInvitationCreation. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this OrganizationInvitationCreation. - - The email address you want to send the invitation to # noqa: E501 - - :param email: The email of this OrganizationInvitationCreation. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def organization_role(self): - """Gets the organization_role of this OrganizationInvitationCreation. # noqa: E501 - - - :return: The organization_role of this OrganizationInvitationCreation. # noqa: E501 - :rtype: OrganizationRoles + The parameters to create an organization invitation + """ # noqa: E501 + email: Optional[StrictStr] = Field(default=None, description="The email address you want to send the invitation to") + organization_role: Optional[StrictStr] = Field(default='teacher', description="User's Organization Role", alias="organizationRole") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["email", "organizationRole"] + + @field_validator('organization_role') + def organization_role_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['admin', 'teacher', 'accountAdmin']): + raise ValueError("must be one of enum values ('admin', 'teacher', 'accountAdmin')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationInvitationCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._organization_role + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationInvitationCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "email": obj.get("email"), + "organizationRole": obj.get("organizationRole") if obj.get("organizationRole") is not None else 'teacher' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @organization_role.setter - def organization_role(self, organization_role): - """Sets the organization_role of this OrganizationInvitationCreation. - - - :param organization_role: The organization_role of this OrganizationInvitationCreation. # noqa: E501 - :type: OrganizationRoles - """ - self._organization_role = organization_role - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, OrganizationInvitationCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/organization_roles.py b/flat_api/models/organization_roles.py index 6dfab5d..cf85a5f 100644 --- a/flat_api/models/organization_roles.py +++ b/flat_api/models/organization_roles.py @@ -3,90 +3,38 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class OrganizationRoles(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class OrganizationRoles(str, Enum): """ - allowed enum values + User's Organization Role (for Edu users only) """ - ADMIN = "admin" - BILLING = "billing" - TEACHER = "teacher" - USER = "user" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """OrganizationRoles - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + ADMIN = 'admin' + ACCOUNTADMIN = 'accountAdmin' + TEACHER = 'teacher' + USER = 'user' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, OrganizationRoles): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OrganizationRoles from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/organization_user_access_token_creation.py b/flat_api/models/organization_user_access_token_creation.py new file mode 100644 index 0000000..1dd7780 --- /dev/null +++ b/flat_api/models/organization_user_access_token_creation.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from flat_api.models.app_scopes import AppScopes +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class OrganizationUserAccessTokenCreation(BaseModel): + """ + Creation of a delegated API access token for an organization user + """ # noqa: E501 + scopes: List[AppScopes] = Field(description="List of requested scopes for this credential") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scopes"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrganizationUserAccessTokenCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrganizationUserAccessTokenCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scopes": obj.get("scopes") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/rename_group_request.py b/flat_api/models/rename_group_request.py new file mode 100644 index 0000000..b3e8786 --- /dev/null +++ b/flat_api/models/rename_group_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RenameGroupRequest(BaseModel): + """ + RenameGroupRequest + """ # noqa: E501 + name: StrictStr = Field(description="New name for the group") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RenameGroupRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RenameGroupRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/resource_collaborator.py b/flat_api/models/resource_collaborator.py index f224346..8d01be0 100644 --- a/flat_api/models/resource_collaborator.py +++ b/flat_api/models/resource_collaborator.py @@ -3,336 +3,143 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.group import Group # noqa: F401,E501 -from flat_api.models.resource_rights import ResourceRights # noqa: F401,E501 -from flat_api.models.user_public import UserPublic # noqa: F401,E501 - - -class ResourceCollaborator(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.group import Group +from flat_api.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ResourceCollaborator(BaseModel): """ - swagger_types = { - 'acl_read': 'bool', - 'acl_write': 'bool', - 'acl_admin': 'bool', - 'id': 'str', - 'score': 'str', - 'collection': 'str', - 'user': 'UserPublic', - 'group': 'Group', - 'user_email': 'str' - } - - attribute_map = { - 'acl_read': 'aclRead', - 'acl_write': 'aclWrite', - 'acl_admin': 'aclAdmin', - 'id': 'id', - 'score': 'score', - 'collection': 'collection', - 'user': 'user', - 'group': 'group', - 'user_email': 'userEmail' - } - - def __init__(self, acl_read=False, acl_write=False, acl_admin=False, id=None, score=None, collection=None, user=None, group=None, user_email=None): # noqa: E501 - """ResourceCollaborator - a model defined in Swagger""" # noqa: E501 - - self._acl_read = None - self._acl_write = None - self._acl_admin = None - self._id = None - self._score = None - self._collection = None - self._user = None - self._group = None - self._user_email = None - self.discriminator = None - - if acl_read is not None: - self.acl_read = acl_read - if acl_write is not None: - self.acl_write = acl_write - if acl_admin is not None: - self.acl_admin = acl_admin - if id is not None: - self.id = id - if score is not None: - self.score = score - if collection is not None: - self.collection = collection - if user is not None: - self.user = user - if group is not None: - self.group = group - if user_email is not None: - self.user_email = user_email - - @property - def acl_read(self): - """Gets the acl_read of this ResourceCollaborator. # noqa: E501 - - `True` if the current user can read the current document # noqa: E501 - - :return: The acl_read of this ResourceCollaborator. # noqa: E501 - :rtype: bool - """ - return self._acl_read - - @acl_read.setter - def acl_read(self, acl_read): - """Sets the acl_read of this ResourceCollaborator. - - `True` if the current user can read the current document # noqa: E501 - - :param acl_read: The acl_read of this ResourceCollaborator. # noqa: E501 - :type: bool - """ - - self._acl_read = acl_read - - @property - def acl_write(self): - """Gets the acl_write of this ResourceCollaborator. # noqa: E501 - - `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. # noqa: E501 - - :return: The acl_write of this ResourceCollaborator. # noqa: E501 - :rtype: bool - """ - return self._acl_write - - @acl_write.setter - def acl_write(self, acl_write): - """Sets the acl_write of this ResourceCollaborator. - - `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. # noqa: E501 - - :param acl_write: The acl_write of this ResourceCollaborator. # noqa: E501 - :type: bool - """ - - self._acl_write = acl_write - - @property - def acl_admin(self): - """Gets the acl_admin of this ResourceCollaborator. # noqa: E501 - - `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. # noqa: E501 - - :return: The acl_admin of this ResourceCollaborator. # noqa: E501 - :rtype: bool - """ - return self._acl_admin - - @acl_admin.setter - def acl_admin(self, acl_admin): - """Sets the acl_admin of this ResourceCollaborator. - - `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. # noqa: E501 - - :param acl_admin: The acl_admin of this ResourceCollaborator. # noqa: E501 - :type: bool - """ - - self._acl_admin = acl_admin - - @property - def id(self): - """Gets the id of this ResourceCollaborator. # noqa: E501 - - The unique identifier of the permission # noqa: E501 - - :return: The id of this ResourceCollaborator. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ResourceCollaborator. - - The unique identifier of the permission # noqa: E501 - - :param id: The id of this ResourceCollaborator. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def score(self): - """Gets the score of this ResourceCollaborator. # noqa: E501 - - If this object is a permission of a score, this property will contain the unique identifier of the score # noqa: E501 - - :return: The score of this ResourceCollaborator. # noqa: E501 - :rtype: str - """ - return self._score - - @score.setter - def score(self, score): - """Sets the score of this ResourceCollaborator. - - If this object is a permission of a score, this property will contain the unique identifier of the score # noqa: E501 - - :param score: The score of this ResourceCollaborator. # noqa: E501 - :type: str - """ - - self._score = score - - @property - def collection(self): - """Gets the collection of this ResourceCollaborator. # noqa: E501 - - If this object is a permission of a collection, this property will contain the unique identifier of the collection # noqa: E501 - - :return: The collection of this ResourceCollaborator. # noqa: E501 - :rtype: str - """ - return self._collection - - @collection.setter - def collection(self, collection): - """Sets the collection of this ResourceCollaborator. - - If this object is a permission of a collection, this property will contain the unique identifier of the collection # noqa: E501 - - :param collection: The collection of this ResourceCollaborator. # noqa: E501 - :type: str - """ - - self._collection = collection - - @property - def user(self): - """Gets the user of this ResourceCollaborator. # noqa: E501 - - - :return: The user of this ResourceCollaborator. # noqa: E501 - :rtype: UserPublic - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ResourceCollaborator. - - - :param user: The user of this ResourceCollaborator. # noqa: E501 - :type: UserPublic - """ - - self._user = user - - @property - def group(self): - """Gets the group of this ResourceCollaborator. # noqa: E501 - - - :return: The group of this ResourceCollaborator. # noqa: E501 - :rtype: Group - """ - return self._group - - @group.setter - def group(self, group): - """Sets the group of this ResourceCollaborator. - - - :param group: The group of this ResourceCollaborator. # noqa: E501 - :type: Group - """ - - self._group = group - - @property - def user_email(self): - """Gets the user_email of this ResourceCollaborator. # noqa: E501 - - If the collaborator is not a user of Flat yet, this field will contain his email. # noqa: E501 - - :return: The user_email of this ResourceCollaborator. # noqa: E501 - :rtype: str - """ - return self._user_email - - @user_email.setter - def user_email(self, user_email): - """Sets the user_email of this ResourceCollaborator. - - If the collaborator is not a user of Flat yet, this field will contain his email. # noqa: E501 - - :param user_email: The user_email of this ResourceCollaborator. # noqa: E501 - :type: str - """ - - self._user_email = user_email - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ResourceCollaborator): - return False + A collaborator of a score. The `userEmail` and `group` are only available if the requesting user is a collaborator of the related score (otherwise these permissions are not listed or exposed publicly). + """ # noqa: E501 + acl_read: StrictBool = Field(description="`True` if the current user can read the current document ", alias="aclRead") + acl_write: StrictBool = Field(description="`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. ", alias="aclWrite") + acl_admin: StrictBool = Field(description="`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. ", alias="aclAdmin") + is_collaborator: Optional[StrictBool] = Field(default=False, description="`True` if the current user is a collaborator of the current document (direct or via group). ", alias="isCollaborator") + collaborator_type: Optional[StrictStr] = Field(default=None, description="The type of the collaborator for the resource ", alias="collaboratorType") + id: Optional[StrictStr] = Field(default=None, description="The unique identifier of the permission") + var_date: Optional[datetime] = Field(default=None, description="The date when the permission was added", alias="date") + score: Optional[StrictStr] = Field(default=None, description="If this object is a permission of a score, this property will contain the unique identifier of the score") + collection: Optional[StrictStr] = Field(default=None, description="If this object is a permission of a collection, this property will contain the unique identifier of the collection") + user: Optional[UserPublic] = None + group: Optional[Group] = None + user_email: Optional[StrictStr] = Field(default=None, description="If the collaborator is not a user of Flat yet, this field will contain their email. ", alias="userEmail") + invited: Optional[StrictBool] = Field(default=None, description="If this property is `true`, this is still a pending invitation ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["aclRead", "aclWrite", "aclAdmin", "isCollaborator", "collaboratorType", "id", "date", "score", "collection", "user", "group", "userEmail", "invited"] + + @field_validator('collaborator_type') + def collaborator_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['owner', 'user', 'group']): + raise ValueError("must be one of enum values ('owner', 'user', 'group')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceCollaborator from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceCollaborator from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else False, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False, + "isCollaborator": obj.get("isCollaborator") if obj.get("isCollaborator") is not None else False, + "collaboratorType": obj.get("collaboratorType"), + "id": obj.get("id"), + "date": obj.get("date"), + "score": obj.get("score"), + "collection": obj.get("collection"), + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "group": Group.from_dict(obj["group"]) if obj.get("group") is not None else None, + "userEmail": obj.get("userEmail"), + "invited": obj.get("invited") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/resource_collaborator_creation.py b/flat_api/models/resource_collaborator_creation.py index 3eed969..e64f366 100644 --- a/flat_api/models/resource_collaborator_creation.py +++ b/flat_api/models/resource_collaborator_creation.py @@ -3,280 +3,112 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class ResourceCollaboratorCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class ResourceCollaboratorCreation(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'user': 'str', - 'group': 'str', - 'user_email': 'str', - 'user_token': 'str', - 'acl_read': 'bool', - 'acl_write': 'bool', - 'acl_admin': 'bool' - } - - attribute_map = { - 'user': 'user', - 'group': 'group', - 'user_email': 'userEmail', - 'user_token': 'userToken', - 'acl_read': 'aclRead', - 'acl_write': 'aclWrite', - 'acl_admin': 'aclAdmin' - } - - def __init__(self, user=None, group=None, user_email=None, user_token=None, acl_read=True, acl_write=False, acl_admin=False): # noqa: E501 - """ResourceCollaboratorCreation - a model defined in Swagger""" # noqa: E501 - - self._user = None - self._group = None - self._user_email = None - self._user_token = None - self._acl_read = None - self._acl_write = None - self._acl_admin = None - self.discriminator = None - - if user is not None: - self.user = user - if group is not None: - self.group = group - if user_email is not None: - self.user_email = user_email - if user_token is not None: - self.user_token = user_token - if acl_read is not None: - self.acl_read = acl_read - if acl_write is not None: - self.acl_write = acl_write - if acl_admin is not None: - self.acl_admin = acl_admin - - @property - def user(self): - """Gets the user of this ResourceCollaboratorCreation. # noqa: E501 - - The unique identifier of a Flat user # noqa: E501 - - :return: The user of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: str + Add a collaborator to a resource. + """ # noqa: E501 + user: Optional[StrictStr] = Field(default=None, description="The unique identifier of a Flat user") + group: Optional[StrictStr] = Field(default=None, description="The unique identifier of a Flat group") + user_email: Optional[StrictStr] = Field(default=None, description="Fill this field to invite an individual user by email. ", alias="userEmail") + user_token: Optional[StrictStr] = Field(default=None, description="Token received in an invitation to join the score. ", alias="userToken") + acl_read: Optional[StrictBool] = Field(default=True, description="`True` if the related user can read the score. (probably true if the user has a permission on the document). ", alias="aclRead") + acl_write: Optional[StrictBool] = Field(default=False, description="`True` if the related user can modify the score. ", alias="aclWrite") + acl_admin: Optional[StrictBool] = Field(default=False, description="`True` if the related user can manage the current document, i.e. changing the document permissions and deleting the document ", alias="aclAdmin") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user", "group", "userEmail", "userToken", "aclRead", "aclWrite", "aclAdmin"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceCollaboratorCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ResourceCollaboratorCreation. - - The unique identifier of a Flat user # noqa: E501 - - :param user: The user of this ResourceCollaboratorCreation. # noqa: E501 - :type: str - """ - - self._user = user - - @property - def group(self): - """Gets the group of this ResourceCollaboratorCreation. # noqa: E501 - - The unique identifier of a Flat group # noqa: E501 - - :return: The group of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: str - """ - return self._group - - @group.setter - def group(self, group): - """Sets the group of this ResourceCollaboratorCreation. - - The unique identifier of a Flat group # noqa: E501 - - :param group: The group of this ResourceCollaboratorCreation. # noqa: E501 - :type: str - """ - - self._group = group - - @property - def user_email(self): - """Gets the user_email of this ResourceCollaboratorCreation. # noqa: E501 - - Fill this field to invite an individual user by email. # noqa: E501 - - :return: The user_email of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: str - """ - return self._user_email - - @user_email.setter - def user_email(self, user_email): - """Sets the user_email of this ResourceCollaboratorCreation. - - Fill this field to invite an individual user by email. # noqa: E501 - - :param user_email: The user_email of this ResourceCollaboratorCreation. # noqa: E501 - :type: str - """ - - self._user_email = user_email - - @property - def user_token(self): - """Gets the user_token of this ResourceCollaboratorCreation. # noqa: E501 - - Token received in an invitation to join the score. # noqa: E501 - - :return: The user_token of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: str - """ - return self._user_token - - @user_token.setter - def user_token(self, user_token): - """Sets the user_token of this ResourceCollaboratorCreation. - - Token received in an invitation to join the score. # noqa: E501 - - :param user_token: The user_token of this ResourceCollaboratorCreation. # noqa: E501 - :type: str - """ - - self._user_token = user_token - - @property - def acl_read(self): - """Gets the acl_read of this ResourceCollaboratorCreation. # noqa: E501 - - `True` if the related user can read the score. (probably true if the user has a permission on the document). # noqa: E501 - - :return: The acl_read of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: bool - """ - return self._acl_read - - @acl_read.setter - def acl_read(self, acl_read): - """Sets the acl_read of this ResourceCollaboratorCreation. - - `True` if the related user can read the score. (probably true if the user has a permission on the document). # noqa: E501 - - :param acl_read: The acl_read of this ResourceCollaboratorCreation. # noqa: E501 - :type: bool - """ - - self._acl_read = acl_read - - @property - def acl_write(self): - """Gets the acl_write of this ResourceCollaboratorCreation. # noqa: E501 - - `True` if the related user can modify the score. # noqa: E501 - - :return: The acl_write of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: bool - """ - return self._acl_write - - @acl_write.setter - def acl_write(self, acl_write): - """Sets the acl_write of this ResourceCollaboratorCreation. - - `True` if the related user can modify the score. # noqa: E501 - - :param acl_write: The acl_write of this ResourceCollaboratorCreation. # noqa: E501 - :type: bool - """ - - self._acl_write = acl_write - - @property - def acl_admin(self): - """Gets the acl_admin of this ResourceCollaboratorCreation. # noqa: E501 - - `True` if the related user can can manage the current document, i.e. changing the document permissions and deleting the document # noqa: E501 - - :return: The acl_admin of this ResourceCollaboratorCreation. # noqa: E501 - :rtype: bool - """ - return self._acl_admin - - @acl_admin.setter - def acl_admin(self, acl_admin): - """Sets the acl_admin of this ResourceCollaboratorCreation. - - `True` if the related user can can manage the current document, i.e. changing the document permissions and deleting the document # noqa: E501 - - :param acl_admin: The acl_admin of this ResourceCollaboratorCreation. # noqa: E501 - :type: bool - """ - - self._acl_admin = acl_admin - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ResourceCollaboratorCreation): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceCollaboratorCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "user": obj.get("user"), + "group": obj.get("group"), + "userEmail": obj.get("userEmail"), + "userToken": obj.get("userToken"), + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else True, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/resource_rights.py b/flat_api/models/resource_rights.py index d7fe87a..ce365ad 100644 --- a/flat_api/models/resource_rights.py +++ b/flat_api/models/resource_rights.py @@ -3,168 +3,118 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ResourceRights(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ResourceRights(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'acl_read': 'bool', - 'acl_write': 'bool', - 'acl_admin': 'bool' - } - - attribute_map = { - 'acl_read': 'aclRead', - 'acl_write': 'aclWrite', - 'acl_admin': 'aclAdmin' - } - - def __init__(self, acl_read=False, acl_write=False, acl_admin=False): # noqa: E501 - """ResourceRights - a model defined in Swagger""" # noqa: E501 - - self._acl_read = None - self._acl_write = None - self._acl_admin = None - self.discriminator = None - - if acl_read is not None: - self.acl_read = acl_read - if acl_write is not None: - self.acl_write = acl_write - if acl_admin is not None: - self.acl_admin = acl_admin - - @property - def acl_read(self): - """Gets the acl_read of this ResourceRights. # noqa: E501 - - `True` if the current user can read the current document # noqa: E501 - - :return: The acl_read of this ResourceRights. # noqa: E501 - :rtype: bool - """ - return self._acl_read - - @acl_read.setter - def acl_read(self, acl_read): - """Sets the acl_read of this ResourceRights. - - `True` if the current user can read the current document # noqa: E501 - - :param acl_read: The acl_read of this ResourceRights. # noqa: E501 - :type: bool - """ - - self._acl_read = acl_read - - @property - def acl_write(self): - """Gets the acl_write of this ResourceRights. # noqa: E501 - - `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. # noqa: E501 - - :return: The acl_write of this ResourceRights. # noqa: E501 - :rtype: bool - """ - return self._acl_write - - @acl_write.setter - def acl_write(self, acl_write): - """Sets the acl_write of this ResourceRights. - - `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. # noqa: E501 - - :param acl_write: The acl_write of this ResourceRights. # noqa: E501 - :type: bool + The rights of the current user on a score or collection + """ # noqa: E501 + acl_read: StrictBool = Field(description="`True` if the current user can read the current document ", alias="aclRead") + acl_write: StrictBool = Field(description="`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. ", alias="aclWrite") + acl_admin: StrictBool = Field(description="`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. ", alias="aclAdmin") + is_collaborator: Optional[StrictBool] = Field(default=False, description="`True` if the current user is a collaborator of the current document (direct or via group). ", alias="isCollaborator") + collaborator_type: Optional[StrictStr] = Field(default=None, description="The type of the collaborator for the resource ", alias="collaboratorType") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["aclRead", "aclWrite", "aclAdmin", "isCollaborator", "collaboratorType"] + + @field_validator('collaborator_type') + def collaborator_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['owner', 'user', 'group']): + raise ValueError("must be one of enum values ('owner', 'user', 'group')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResourceRights from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResourceRights from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aclRead": obj.get("aclRead") if obj.get("aclRead") is not None else False, + "aclWrite": obj.get("aclWrite") if obj.get("aclWrite") is not None else False, + "aclAdmin": obj.get("aclAdmin") if obj.get("aclAdmin") is not None else False, + "isCollaborator": obj.get("isCollaborator") if obj.get("isCollaborator") is not None else False, + "collaboratorType": obj.get("collaboratorType") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._acl_write = acl_write - - @property - def acl_admin(self): - """Gets the acl_admin of this ResourceRights. # noqa: E501 - - `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. # noqa: E501 - - :return: The acl_admin of this ResourceRights. # noqa: E501 - :rtype: bool - """ - return self._acl_admin - - @acl_admin.setter - def acl_admin(self, acl_admin): - """Sets the acl_admin of this ResourceRights. - - `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. # noqa: E501 - - :param acl_admin: The acl_admin of this ResourceRights. # noqa: E501 - :type: bool - """ - self._acl_admin = acl_admin - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ResourceRights): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/resource_sharing_key.py b/flat_api/models/resource_sharing_key.py deleted file mode 100644 index e5234ae..0000000 --- a/flat_api/models/resource_sharing_key.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ResourceSharingKey(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ResourceSharingKey - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ResourceSharingKey): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_comment.py b/flat_api/models/score_comment.py index 667fb57..09e6b85 100644 --- a/flat_api/models/score_comment.py +++ b/flat_api/models/score_comment.py @@ -3,510 +3,146 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.score_comment_context import ScoreCommentContext # noqa: F401,E501 - - -class ScoreComment(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_comment_context import ScoreCommentContext +from flat_api.models.score_comment_moderation import ScoreCommentModeration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreComment(BaseModel): """ - swagger_types = { - 'id': 'str', - 'type': 'str', - 'user': 'str', - 'score': 'str', - 'revision': 'str', - 'reply_to': 'str', - 'date': 'datetime', - 'modification_date': 'datetime', - 'comment': 'str', - 'raw_comment': 'str', - 'context': 'ScoreCommentContext', - 'mentions': 'list[str]', - 'resolved': 'bool', - 'resolved_by': 'str', - 'spam': 'bool' - } - - attribute_map = { - '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', - 'spam': 'spam' - } - - def __init__(self, id=None, type=None, user=None, score=None, revision=None, reply_to=None, date=None, modification_date=None, comment=None, raw_comment=None, context=None, mentions=None, resolved=None, resolved_by=None, spam=None): # noqa: E501 - """ScoreComment - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._type = None - self._user = None - self._score = None - self._revision = None - self._reply_to = None - self._date = None - self._modification_date = None - self._comment = None - self._raw_comment = None - self._context = None - self._mentions = None - self._resolved = None - self._resolved_by = None - self._spam = None - self.discriminator = None - - if id is not None: - self.id = id - if type is not None: - self.type = type - if user is not None: - self.user = user - if score is not None: - self.score = score - if revision is not None: - self.revision = revision - if reply_to is not None: - self.reply_to = reply_to - if date is not None: - self.date = date - if modification_date is not None: - self.modification_date = modification_date - if comment is not None: - self.comment = comment - if raw_comment is not None: - self.raw_comment = raw_comment - if context is not None: - self.context = context - if mentions is not None: - self.mentions = mentions - if resolved is not None: - self.resolved = resolved - if resolved_by is not None: - self.resolved_by = resolved_by - if spam is not None: - self.spam = spam - - @property - def id(self): - """Gets the id of this ScoreComment. # noqa: E501 - - The comment unique identifier # noqa: E501 - - :return: The id of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScoreComment. - - The comment unique identifier # noqa: E501 - - :param id: The id of this ScoreComment. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def type(self): - """Gets the type of this ScoreComment. # noqa: E501 - - The type of the comment # noqa: E501 - - :return: The type of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ScoreComment. - - The type of the comment # noqa: E501 - - :param type: The type of this ScoreComment. # noqa: E501 - :type: str - """ - allowed_values = ["document", "inline"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def user(self): - """Gets the user of this ScoreComment. # noqa: E501 - - The author unique identifier # noqa: E501 - - :return: The user of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ScoreComment. - - The author unique identifier # noqa: E501 - - :param user: The user of this ScoreComment. # noqa: E501 - :type: str - """ - - self._user = user - - @property - def score(self): - """Gets the score of this ScoreComment. # noqa: E501 - - The unique identifier of the score where the comment was posted # noqa: E501 - - :return: The score of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._score - - @score.setter - def score(self, score): - """Sets the score of this ScoreComment. - - The unique identifier of the score where the comment was posted # noqa: E501 - - :param score: The score of this ScoreComment. # noqa: E501 - :type: str - """ - - self._score = score - - @property - def revision(self): - """Gets the revision of this ScoreComment. # noqa: E501 - - The unique identifier of revision the comment was posted # noqa: E501 - - :return: The revision of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._revision - - @revision.setter - def revision(self, revision): - """Sets the revision of this ScoreComment. - - The unique identifier of revision the comment was posted # noqa: E501 - - :param revision: The revision of this ScoreComment. # noqa: E501 - :type: str - """ - - self._revision = revision - - @property - def reply_to(self): - """Gets the reply_to of this ScoreComment. # noqa: E501 - - When the comment is a reply to another comment, the unique identifier of the parent comment # noqa: E501 - - :return: The reply_to of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._reply_to - - @reply_to.setter - def reply_to(self, reply_to): - """Sets the reply_to of this ScoreComment. - - When the comment is a reply to another comment, the unique identifier of the parent comment # noqa: E501 - - :param reply_to: The reply_to of this ScoreComment. # noqa: E501 - :type: str - """ - - self._reply_to = reply_to - - @property - def date(self): - """Gets the date of this ScoreComment. # noqa: E501 - - The date when the comment was posted # noqa: E501 - - :return: The date of this ScoreComment. # noqa: E501 - :rtype: datetime - """ - return self._date - - @date.setter - def date(self, date): - """Sets the date of this ScoreComment. - - The date when the comment was posted # noqa: E501 - - :param date: The date of this ScoreComment. # noqa: E501 - :type: datetime - """ - - self._date = date - - @property - def modification_date(self): - """Gets the modification_date of this ScoreComment. # noqa: E501 - - The date of the last comment modification # noqa: E501 - - :return: The modification_date of this ScoreComment. # noqa: E501 - :rtype: datetime - """ - return self._modification_date - - @modification_date.setter - def modification_date(self, modification_date): - """Sets the modification_date of this ScoreComment. - - The date of the last comment modification # noqa: E501 - - :param modification_date: The modification_date of this ScoreComment. # noqa: E501 - :type: datetime - """ - - self._modification_date = modification_date - - @property - def comment(self): - """Gets the comment of this ScoreComment. # noqa: E501 - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :return: The comment of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._comment - - @comment.setter - def comment(self, comment): - """Sets the comment of this ScoreComment. - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :param comment: The comment of this ScoreComment. # noqa: E501 - :type: str - """ - - self._comment = comment - - @property - def raw_comment(self): - """Gets the raw_comment of this ScoreComment. # noqa: E501 - - A raw version of the comment, that can be displayed without parsing the mentions. # noqa: E501 - - :return: The raw_comment of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._raw_comment - - @raw_comment.setter - def raw_comment(self, raw_comment): - """Sets the raw_comment of this ScoreComment. - - A raw version of the comment, that can be displayed without parsing the mentions. # noqa: E501 - - :param raw_comment: The raw_comment of this ScoreComment. # noqa: E501 - :type: str - """ - - self._raw_comment = raw_comment - - @property - def context(self): - """Gets the context of this ScoreComment. # noqa: E501 - - - :return: The context of this ScoreComment. # noqa: E501 - :rtype: ScoreCommentContext - """ - return self._context - - @context.setter - def context(self, context): - """Sets the context of this ScoreComment. - - - :param context: The context of this ScoreComment. # noqa: E501 - :type: ScoreCommentContext - """ - - self._context = context - - @property - def mentions(self): - """Gets the mentions of this ScoreComment. # noqa: E501 - - The list of user identifier mentioned on the score # noqa: E501 - - :return: The mentions of this ScoreComment. # noqa: E501 - :rtype: list[str] - """ - return self._mentions - - @mentions.setter - def mentions(self, mentions): - """Sets the mentions of this ScoreComment. - - The list of user identifier mentioned on the score # noqa: E501 - - :param mentions: The mentions of this ScoreComment. # noqa: E501 - :type: list[str] - """ - - self._mentions = mentions - - @property - def resolved(self): - """Gets the resolved of this ScoreComment. # noqa: E501 - - For inline comments, the comment can be marked as resolved and will be hidden in the future responses # noqa: E501 - - :return: The resolved of this ScoreComment. # noqa: E501 - :rtype: bool - """ - return self._resolved - - @resolved.setter - def resolved(self, resolved): - """Sets the resolved of this ScoreComment. - - For inline comments, the comment can be marked as resolved and will be hidden in the future responses # noqa: E501 - - :param resolved: The resolved of this ScoreComment. # noqa: E501 - :type: bool - """ - - self._resolved = resolved - - @property - def resolved_by(self): - """Gets the resolved_by of this ScoreComment. # noqa: E501 - - If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved # noqa: E501 - - :return: The resolved_by of this ScoreComment. # noqa: E501 - :rtype: str - """ - return self._resolved_by - - @resolved_by.setter - def resolved_by(self, resolved_by): - """Sets the resolved_by of this ScoreComment. - - If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved # noqa: E501 - - :param resolved_by: The resolved_by of this ScoreComment. # noqa: E501 - :type: str - """ - - self._resolved_by = resolved_by - - @property - def spam(self): - """Gets the spam of this ScoreComment. # noqa: E501 - - `true if the message has been detected as spam and hidden from other users # noqa: E501 - - :return: The spam of this ScoreComment. # noqa: E501 - :rtype: bool - """ - return self._spam - - @spam.setter - def spam(self, spam): - """Sets the spam of this ScoreComment. - - `true if the message has been detected as spam and hidden from other users # noqa: E501 - - :param spam: The spam of this ScoreComment. # noqa: E501 - :type: bool - """ - - self._spam = spam - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreComment): - return False + Comment added on a sheet music + """ # noqa: E501 + id: StrictStr = Field(description="The comment unique identifier") + type: StrictStr = Field(description="The type of the comment") + user: StrictStr = Field(description="The author unique identifier") + score: StrictStr = Field(description="The unique identifier of the score where the comment was posted") + revision: Optional[StrictStr] = Field(default=None, description="The unique identifier of the revision where the comment was posted") + reply_to: Optional[StrictStr] = Field(default=None, description="When the comment is a reply to another comment, the unique identifier of the parent comment ", alias="replyTo") + var_date: datetime = Field(description="The date when the comment was posted", alias="date") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last comment modification", alias="modificationDate") + comment: StrictStr = Field(description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: StrictStr = Field(description="A raw version of the comment, that can be displayed without parsing the mentions. ", alias="rawComment") + context: Optional[ScoreCommentContext] = None + mentions: Optional[List[StrictStr]] = Field(default=None, description="The list of user identifiers mentioned in this comment") + resolved: Optional[StrictBool] = Field(default=None, description="For inline comments, the comment can be marked as resolved and will be hidden in the future responses ") + resolved_by: Optional[StrictStr] = Field(default=None, description="If the comment is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved ", alias="resolvedBy") + moderation: Optional[ScoreCommentModeration] = None + spam: Optional[StrictBool] = Field(default=None, description="`true` if the message has been detected as spam and hidden from other users ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "user", "score", "revision", "replyTo", "date", "modificationDate", "comment", "rawComment", "context", "mentions", "resolved", "resolvedBy", "moderation", "spam"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['document', 'inline']): + raise ValueError("must be one of enum values ('document', 'inline')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreComment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # override the default output from pydantic by calling `to_dict()` of moderation + if self.moderation: + _dict['moderation'] = self.moderation.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreComment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "user": obj.get("user"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "replyTo": obj.get("replyTo"), + "date": obj.get("date"), + "modificationDate": obj.get("modificationDate"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None, + "mentions": obj.get("mentions"), + "resolved": obj.get("resolved"), + "resolvedBy": obj.get("resolvedBy"), + "moderation": ScoreCommentModeration.from_dict(obj["moderation"]) if obj.get("moderation") is not None else None, + "spam": obj.get("spam") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_comment_context.py b/flat_api/models/score_comment_context.py index 5a16971..56fd45b 100644 --- a/flat_api/models/score_comment_context.py +++ b/flat_api/models/score_comment_context.py @@ -3,279 +3,114 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class ScoreCommentContext(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class ScoreCommentContext(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'part_uuid': 'str', - 'staff_idx': 'float', - 'measure_uuids': 'list[str]', - 'start_time_pos': 'float', - 'stop_time_pos': 'float', - 'start_dpq': 'float', - 'stop_dpq': 'float' - } - - attribute_map = { - 'part_uuid': 'partUuid', - 'staff_idx': 'staffIdx', - 'measure_uuids': 'measureUuids', - 'start_time_pos': 'startTimePos', - 'stop_time_pos': 'stopTimePos', - 'start_dpq': 'startDpq', - 'stop_dpq': 'stopDpq' - } - - def __init__(self, part_uuid=None, staff_idx=None, measure_uuids=None, start_time_pos=None, stop_time_pos=None, start_dpq=None, stop_dpq=None): # noqa: E501 - """ScoreCommentContext - a model defined in Swagger""" # noqa: E501 - - self._part_uuid = None - self._staff_idx = None - self._measure_uuids = None - self._start_time_pos = None - self._stop_time_pos = None - self._start_dpq = None - self._stop_dpq = None - self.discriminator = None - - self.part_uuid = part_uuid - self.staff_idx = staff_idx - self.measure_uuids = measure_uuids - self.start_time_pos = start_time_pos - self.stop_time_pos = stop_time_pos - self.start_dpq = start_dpq - self.stop_dpq = stop_dpq - - @property - def part_uuid(self): - """Gets the part_uuid of this ScoreCommentContext. # noqa: E501 - - The unique identifier (UUID) of the score part # noqa: E501 - - :return: The part_uuid of this ScoreCommentContext. # noqa: E501 - :rtype: str + The context of the comment (for inline/contextualized comments). A context will include all the information related to the location of the comment (i.e. score parts, range of measure, time position). + """ # noqa: E501 + part_uuid: StrictStr = Field(description="The unique identifier (UUID) of the score part", alias="partUuid") + staff_idx: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="(Deprecated, use `staffUuid`) The identifier of the staff", alias="staffIdx") + staff_uuid: Optional[StrictStr] = Field(default=None, description="The unique identifier (UUID) of the staff", alias="staffUuid") + measure_uuids: List[StrictStr] = Field(description="The list of measure UUIDs", alias="measureUuids") + start_time_pos: Union[StrictFloat, StrictInt] = Field(alias="startTimePos") + stop_time_pos: Union[StrictFloat, StrictInt] = Field(alias="stopTimePos") + start_dpq: Union[StrictFloat, StrictInt] = Field(alias="startDpq") + stop_dpq: Union[StrictFloat, StrictInt] = Field(alias="stopDpq") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["partUuid", "staffIdx", "staffUuid", "measureUuids", "startTimePos", "stopTimePos", "startDpq", "stopDpq"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentContext from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._part_uuid - - @part_uuid.setter - def part_uuid(self, part_uuid): - """Sets the part_uuid of this ScoreCommentContext. - - The unique identifier (UUID) of the score part # noqa: E501 - - :param part_uuid: The part_uuid of this ScoreCommentContext. # noqa: E501 - :type: str - """ - if part_uuid is None: - raise ValueError("Invalid value for `part_uuid`, must not be `None`") # noqa: E501 - - self._part_uuid = part_uuid - - @property - def staff_idx(self): - """Gets the staff_idx of this ScoreCommentContext. # noqa: E501 - - The identififer of the staff # noqa: E501 - - :return: The staff_idx of this ScoreCommentContext. # noqa: E501 - :rtype: float - """ - return self._staff_idx - - @staff_idx.setter - def staff_idx(self, staff_idx): - """Sets the staff_idx of this ScoreCommentContext. - - The identififer of the staff # noqa: E501 - - :param staff_idx: The staff_idx of this ScoreCommentContext. # noqa: E501 - :type: float - """ - if staff_idx is None: - raise ValueError("Invalid value for `staff_idx`, must not be `None`") # noqa: E501 - - self._staff_idx = staff_idx - - @property - def measure_uuids(self): - """Gets the measure_uuids of this ScoreCommentContext. # noqa: E501 - - The list of measure UUIds # noqa: E501 - - :return: The measure_uuids of this ScoreCommentContext. # noqa: E501 - :rtype: list[str] - """ - return self._measure_uuids - - @measure_uuids.setter - def measure_uuids(self, measure_uuids): - """Sets the measure_uuids of this ScoreCommentContext. - - The list of measure UUIds # noqa: E501 - - :param measure_uuids: The measure_uuids of this ScoreCommentContext. # noqa: E501 - :type: list[str] - """ - if measure_uuids is None: - raise ValueError("Invalid value for `measure_uuids`, must not be `None`") # noqa: E501 - - self._measure_uuids = measure_uuids - - @property - def start_time_pos(self): - """Gets the start_time_pos of this ScoreCommentContext. # noqa: E501 - - - :return: The start_time_pos of this ScoreCommentContext. # noqa: E501 - :rtype: float - """ - return self._start_time_pos - - @start_time_pos.setter - def start_time_pos(self, start_time_pos): - """Sets the start_time_pos of this ScoreCommentContext. - - - :param start_time_pos: The start_time_pos of this ScoreCommentContext. # noqa: E501 - :type: float - """ - if start_time_pos is None: - raise ValueError("Invalid value for `start_time_pos`, must not be `None`") # noqa: E501 - - self._start_time_pos = start_time_pos - - @property - def stop_time_pos(self): - """Gets the stop_time_pos of this ScoreCommentContext. # noqa: E501 - - - :return: The stop_time_pos of this ScoreCommentContext. # noqa: E501 - :rtype: float - """ - return self._stop_time_pos - - @stop_time_pos.setter - def stop_time_pos(self, stop_time_pos): - """Sets the stop_time_pos of this ScoreCommentContext. - - - :param stop_time_pos: The stop_time_pos of this ScoreCommentContext. # noqa: E501 - :type: float - """ - if stop_time_pos is None: - raise ValueError("Invalid value for `stop_time_pos`, must not be `None`") # noqa: E501 - - self._stop_time_pos = stop_time_pos - - @property - def start_dpq(self): - """Gets the start_dpq of this ScoreCommentContext. # noqa: E501 - - - :return: The start_dpq of this ScoreCommentContext. # noqa: E501 - :rtype: float - """ - return self._start_dpq - - @start_dpq.setter - def start_dpq(self, start_dpq): - """Sets the start_dpq of this ScoreCommentContext. - - - :param start_dpq: The start_dpq of this ScoreCommentContext. # noqa: E501 - :type: float - """ - if start_dpq is None: - raise ValueError("Invalid value for `start_dpq`, must not be `None`") # noqa: E501 - - self._start_dpq = start_dpq - - @property - def stop_dpq(self): - """Gets the stop_dpq of this ScoreCommentContext. # noqa: E501 - - - :return: The stop_dpq of this ScoreCommentContext. # noqa: E501 - :rtype: float - """ - return self._stop_dpq - - @stop_dpq.setter - def stop_dpq(self, stop_dpq): - """Sets the stop_dpq of this ScoreCommentContext. - - - :param stop_dpq: The stop_dpq of this ScoreCommentContext. # noqa: E501 - :type: float - """ - if stop_dpq is None: - raise ValueError("Invalid value for `stop_dpq`, must not be `None`") # noqa: E501 - - self._stop_dpq = stop_dpq - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCommentContext): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentContext from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "partUuid": obj.get("partUuid"), + "staffIdx": obj.get("staffIdx"), + "staffUuid": obj.get("staffUuid"), + "measureUuids": obj.get("measureUuids"), + "startTimePos": obj.get("startTimePos"), + "stopTimePos": obj.get("stopTimePos"), + "startDpq": obj.get("startDpq"), + "stopDpq": obj.get("stopDpq") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_comment_creation.py b/flat_api/models/score_comment_creation.py index 63bffdb..66fb875 100644 --- a/flat_api/models/score_comment_creation.py +++ b/flat_api/models/score_comment_creation.py @@ -3,253 +3,114 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.score_comment_context import ScoreCommentContext # noqa: F401,E501 +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_comment_context import ScoreCommentContext +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class ScoreCommentCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class ScoreCommentCreation(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'revision': 'str', - 'comment': 'str', - 'raw_comment': 'str', - 'mentions': 'list[str]', - 'reply_to': 'str', - 'context': 'ScoreCommentContext' - } - - attribute_map = { - 'revision': 'revision', - 'comment': 'comment', - 'raw_comment': 'rawComment', - 'mentions': 'mentions', - 'reply_to': 'replyTo', - 'context': 'context' - } - - def __init__(self, revision=None, comment=None, raw_comment=None, mentions=None, reply_to=None, context=None): # noqa: E501 - """ScoreCommentCreation - a model defined in Swagger""" # noqa: E501 - - self._revision = None - self._comment = None - self._raw_comment = None - self._mentions = None - self._reply_to = None - self._context = None - self.discriminator = None - - if revision is not None: - self.revision = revision - self.comment = comment - if raw_comment is not None: - self.raw_comment = raw_comment - if mentions is not None: - self.mentions = mentions - if reply_to is not None: - self.reply_to = reply_to - if context is not None: - self.context = context - - @property - def revision(self): - """Gets the revision of this ScoreCommentCreation. # noqa: E501 - - 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. # noqa: E501 - - :return: The revision of this ScoreCommentCreation. # noqa: E501 - :rtype: str - """ - return self._revision - - @revision.setter - def revision(self, revision): - """Sets the revision of this ScoreCommentCreation. - - 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. # noqa: E501 - - :param revision: The revision of this ScoreCommentCreation. # noqa: E501 - :type: str - """ - - self._revision = revision - - @property - def comment(self): - """Gets the comment of this ScoreCommentCreation. # noqa: E501 - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :return: The comment of this ScoreCommentCreation. # noqa: E501 - :rtype: str - """ - return self._comment - - @comment.setter - def comment(self, comment): - """Sets the comment of this ScoreCommentCreation. - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :param comment: The comment of this ScoreCommentCreation. # noqa: E501 - :type: str - """ - if comment is None: - raise ValueError("Invalid value for `comment`, must not be `None`") # noqa: E501 - - self._comment = comment - - @property - def raw_comment(self): - """Gets the raw_comment of this ScoreCommentCreation. # noqa: E501 - - A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. # noqa: E501 - - :return: The raw_comment of this ScoreCommentCreation. # noqa: E501 - :rtype: str - """ - return self._raw_comment - - @raw_comment.setter - def raw_comment(self, raw_comment): - """Sets the raw_comment of this ScoreCommentCreation. - - A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. # noqa: E501 - - :param raw_comment: The raw_comment of this ScoreCommentCreation. # noqa: E501 - :type: str - """ - - self._raw_comment = raw_comment - - @property - def mentions(self): - """Gets the mentions of this ScoreCommentCreation. # noqa: E501 - - The list of user identifiers mentioned in this comment # noqa: E501 - - :return: The mentions of this ScoreCommentCreation. # noqa: E501 - :rtype: list[str] + Creation of a comment + """ # noqa: E501 + revision: Optional[StrictStr] = Field(default=None, description="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. ") + comment: StrictStr = Field(description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: Optional[StrictStr] = Field(default=None, description="A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. ", alias="rawComment") + mentions: Optional[List[StrictStr]] = Field(default=None, description="The list of user identifiers mentioned in this comment") + reply_to: Optional[StrictStr] = Field(default=None, description="When the comment is a reply to another comment, the unique identifier of the parent comment ", alias="replyTo") + context: Optional[ScoreCommentContext] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["revision", "comment", "rawComment", "mentions", "replyTo", "context"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._mentions - - @mentions.setter - def mentions(self, mentions): - """Sets the mentions of this ScoreCommentCreation. - - The list of user identifiers mentioned in this comment # noqa: E501 - - :param mentions: The mentions of this ScoreCommentCreation. # noqa: E501 - :type: list[str] - """ - - self._mentions = mentions - - @property - def reply_to(self): - """Gets the reply_to of this ScoreCommentCreation. # noqa: E501 - - When the comment is a reply to another comment, the unique identifier of the parent comment # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "revision": obj.get("revision"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "mentions": obj.get("mentions"), + "replyTo": obj.get("replyTo"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :return: The reply_to of this ScoreCommentCreation. # noqa: E501 - :rtype: str - """ - return self._reply_to - - @reply_to.setter - def reply_to(self, reply_to): - """Sets the reply_to of this ScoreCommentCreation. - - When the comment is a reply to another comment, the unique identifier of the parent comment # noqa: E501 - - :param reply_to: The reply_to of this ScoreCommentCreation. # noqa: E501 - :type: str - """ - - self._reply_to = reply_to - - @property - def context(self): - """Gets the context of this ScoreCommentCreation. # noqa: E501 - - - :return: The context of this ScoreCommentCreation. # noqa: E501 - :rtype: ScoreCommentContext - """ - return self._context - - @context.setter - def context(self, context): - """Sets the context of this ScoreCommentCreation. - - - :param context: The context of this ScoreCommentCreation. # noqa: E501 - :type: ScoreCommentContext - """ - self._context = context - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCommentCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_comment_moderation.py b/flat_api/models/score_comment_moderation.py new file mode 100644 index 0000000..c5a8e89 --- /dev/null +++ b/flat_api/models/score_comment_moderation.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCommentModeration(BaseModel): + """ + Information about the comment being moderated + """ # noqa: E501 + hidden: Optional[StrictBool] = Field(default=None, description="If true, this comment will be hidden from other users") + reason: Optional[StrictStr] = Field(default=None, description="If the comment is hidden, the reason why this one has been moderated") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["hidden", "reason"] + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['spam', 'inappropriate']): + raise ValueError("must be one of enum values ('spam', 'inappropriate')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentModeration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentModeration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "hidden": obj.get("hidden"), + "reason": obj.get("reason") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_comment_update.py b/flat_api/models/score_comment_update.py index f2fc51a..c9e0cc7 100644 --- a/flat_api/models/score_comment_update.py +++ b/flat_api/models/score_comment_update.py @@ -3,204 +3,111 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.score_comment_context import ScoreCommentContext # noqa: F401,E501 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.score_comment_context import ScoreCommentContext +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python -class ScoreCommentUpdate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +class ScoreCommentUpdate(BaseModel): """ - swagger_types = { - 'revision': 'str', - 'comment': 'str', - 'raw_comment': 'str', - 'context': 'ScoreCommentContext' - } - - attribute_map = { - 'revision': 'revision', - 'comment': 'comment', - 'raw_comment': 'rawComment', - 'context': 'context' - } - - def __init__(self, revision=None, comment=None, raw_comment=None, context=None): # noqa: E501 - """ScoreCommentUpdate - a model defined in Swagger""" # noqa: E501 - - self._revision = None - self._comment = None - self._raw_comment = None - self._context = None - self.discriminator = None - - if revision is not None: - self.revision = revision - if comment is not None: - self.comment = comment - if raw_comment is not None: - self.raw_comment = raw_comment - if context is not None: - self.context = context - - @property - def revision(self): - """Gets the revision of this ScoreCommentUpdate. # noqa: E501 - - 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. # noqa: E501 - - :return: The revision of this ScoreCommentUpdate. # noqa: E501 - :rtype: str - """ - return self._revision - - @revision.setter - def revision(self, revision): - """Sets the revision of this ScoreCommentUpdate. - - 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. # noqa: E501 - - :param revision: The revision of this ScoreCommentUpdate. # noqa: E501 - :type: str - """ - - self._revision = revision - - @property - def comment(self): - """Gets the comment of this ScoreCommentUpdate. # noqa: E501 - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :return: The comment of this ScoreCommentUpdate. # noqa: E501 - :rtype: str - """ - return self._comment - - @comment.setter - def comment(self, comment): - """Sets the comment of this ScoreCommentUpdate. - - The comment text that can includes mentions using the following format: `@[id:username]`. # noqa: E501 - - :param comment: The comment of this ScoreCommentUpdate. # noqa: E501 - :type: str - """ - if comment is not None and len(comment) > 10000: - raise ValueError("Invalid value for `comment`, length must be less than or equal to `10000`") # noqa: E501 - if comment is not None and len(comment) < 1: - raise ValueError("Invalid value for `comment`, length must be greater than or equal to `1`") # noqa: E501 - - self._comment = comment - - @property - def raw_comment(self): - """Gets the raw_comment of this ScoreCommentUpdate. # noqa: E501 - - A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. # noqa: E501 - - :return: The raw_comment of this ScoreCommentUpdate. # noqa: E501 - :rtype: str - """ - return self._raw_comment - - @raw_comment.setter - def raw_comment(self, raw_comment): - """Sets the raw_comment of this ScoreCommentUpdate. - - A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. # noqa: E501 - - :param raw_comment: The raw_comment of this ScoreCommentUpdate. # noqa: E501 - :type: str - """ - if raw_comment is not None and len(raw_comment) > 10000: - raise ValueError("Invalid value for `raw_comment`, length must be less than or equal to `10000`") # noqa: E501 - if raw_comment is not None and len(raw_comment) < 1: - raise ValueError("Invalid value for `raw_comment`, length must be greater than or equal to `1`") # noqa: E501 - - self._raw_comment = raw_comment - - @property - def context(self): - """Gets the context of this ScoreCommentUpdate. # noqa: E501 - - - :return: The context of this ScoreCommentUpdate. # noqa: E501 - :rtype: ScoreCommentContext + Update of a comment + """ # noqa: E501 + revision: Optional[StrictStr] = Field(default=None, description="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. ") + comment: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=10000)]] = Field(default=None, description="The comment text that can include mentions using the following format: `@[id:username]`. ") + raw_comment: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=10000)]] = Field(default=None, description="A raw version of the comment, that can be displayed without the mentions. If you use mentions, this property must be set. ", alias="rawComment") + context: Optional[ScoreCommentContext] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["revision", "comment", "rawComment", "context"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._context - - @context.setter - def context(self, context): - """Sets the context of this ScoreCommentUpdate. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context + if self.context: + _dict['context'] = self.context.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "revision": obj.get("revision"), + "comment": obj.get("comment"), + "rawComment": obj.get("rawComment"), + "context": ScoreCommentContext.from_dict(obj["context"]) if obj.get("context") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param context: The context of this ScoreCommentUpdate. # noqa: E501 - :type: ScoreCommentContext - """ - - self._context = context - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCommentUpdate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_comments_counts.py b/flat_api/models/score_comments_counts.py index e0bc2f3..811c2bd 100644 --- a/flat_api/models/score_comments_counts.py +++ b/flat_api/models/score_comments_counts.py @@ -3,196 +3,108 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreCommentsCounts(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreCommentsCounts(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'total': 'float', - 'unique': 'float', - 'weekly': 'float', - 'monthly': 'float' - } - - attribute_map = { - 'total': 'total', - 'unique': 'unique', - 'weekly': 'weekly', - 'monthly': 'monthly' - } - - def __init__(self, total=None, unique=None, weekly=None, monthly=None): # noqa: E501 - """ScoreCommentsCounts - a model defined in Swagger""" # noqa: E501 - - self._total = None - self._unique = None - self._weekly = None - self._monthly = None - self.discriminator = None - - if total is not None: - self.total = total - if unique is not None: - self.unique = unique - if weekly is not None: - self.weekly = weekly - if monthly is not None: - self.monthly = monthly - - @property - def total(self): - """Gets the total of this ScoreCommentsCounts. # noqa: E501 - - The total number of comments added on the score # noqa: E501 - - :return: The total of this ScoreCommentsCounts. # noqa: E501 - :rtype: float - """ - return self._total - - @total.setter - def total(self, total): - """Sets the total of this ScoreCommentsCounts. - - The total number of comments added on the score # noqa: E501 - - :param total: The total of this ScoreCommentsCounts. # noqa: E501 - :type: float - """ - - self._total = total - - @property - def unique(self): - """Gets the unique of this ScoreCommentsCounts. # noqa: E501 - - The unique (1/user) number of comments added on the score # noqa: E501 - - :return: The unique of this ScoreCommentsCounts. # noqa: E501 - :rtype: float + A computed version of the total, unique, weekly, monthly and yearly number of comments added on the documents (this doesn't include inline comments). + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of comments added to the score") + unique: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The unique (1/user) number of comments added to the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly unique number of comments added to the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly unique number of comments added to the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly unique number of comments added to the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "unique", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCommentsCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._unique - - @unique.setter - def unique(self, unique): - """Sets the unique of this ScoreCommentsCounts. - - The unique (1/user) number of comments added on the score # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCommentsCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "unique": obj.get("unique"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param unique: The unique of this ScoreCommentsCounts. # noqa: E501 - :type: float - """ - - self._unique = unique - - @property - def weekly(self): - """Gets the weekly of this ScoreCommentsCounts. # noqa: E501 - - The weekly unique number of comments added on the score # noqa: E501 - - :return: The weekly of this ScoreCommentsCounts. # noqa: E501 - :rtype: float - """ - return self._weekly - - @weekly.setter - def weekly(self, weekly): - """Sets the weekly of this ScoreCommentsCounts. - - The weekly unique number of comments added on the score # noqa: E501 - - :param weekly: The weekly of this ScoreCommentsCounts. # noqa: E501 - :type: float - """ - - self._weekly = weekly - - @property - def monthly(self): - """Gets the monthly of this ScoreCommentsCounts. # noqa: E501 - - The monthly unique number of comments added on the score # noqa: E501 - - :return: The monthly of this ScoreCommentsCounts. # noqa: E501 - :rtype: float - """ - return self._monthly - - @monthly.setter - def monthly(self, monthly): - """Sets the monthly of this ScoreCommentsCounts. - - The monthly unique number of comments added on the score # noqa: E501 - - :param monthly: The monthly of this ScoreCommentsCounts. # noqa: E501 - :type: float - """ - self._monthly = monthly - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCommentsCounts): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_creation.py b/flat_api/models/score_creation.py index 22c6d88..2cf68e5 100644 --- a/flat_api/models/score_creation.py +++ b/flat_api/models/score_creation.py @@ -3,278 +3,150 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from flat_api.models.score_data import ScoreData # noqa: F401,E501 -from flat_api.models.score_data_encoding import ScoreDataEncoding # noqa: F401,E501 -from flat_api.models.score_privacy import ScorePrivacy # noqa: F401,E501 -from flat_api.models.score_source import ScoreSource # noqa: F401,E501 - - -class ScoreCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. - """ +""" # noqa: E501 + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flat_api.models.score_creation_builder_data import ScoreCreationBuilderData +from flat_api.models.score_creation_file_import import ScoreCreationFileImport +from flat_api.models.score_creation_google_drive_import import ScoreCreationGoogleDriveImport +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +SCORECREATION_ONE_OF_SCHEMAS = ["ScoreCreationBuilderData", "ScoreCreationFileImport", "ScoreCreationGoogleDriveImport"] + +class ScoreCreation(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + ScoreCreation """ - swagger_types = { - 'title': 'str', - 'privacy': 'ScorePrivacy', - 'data': 'ScoreData', - 'data_encoding': 'ScoreDataEncoding', - 'source': 'ScoreSource', - 'collection': 'str', - 'google_drive_folder': 'str' - } - - attribute_map = { - 'title': 'title', - 'privacy': 'privacy', - 'data': 'data', - 'data_encoding': 'dataEncoding', - 'source': 'source', - 'collection': 'collection', - 'google_drive_folder': 'googleDriveFolder' - } - - def __init__(self, title=None, privacy=None, data=None, data_encoding=None, source=None, collection=None, google_drive_folder=None): # noqa: E501 - """ScoreCreation - a model defined in Swagger""" # noqa: E501 - - self._title = None - self._privacy = None - self._data = None - self._data_encoding = None - self._source = None - self._collection = None - self._google_drive_folder = None - self.discriminator = None - - if title is not None: - self.title = title - self.privacy = privacy - if data is not None: - self.data = data - if data_encoding is not None: - self.data_encoding = data_encoding - if source is not None: - self.source = source - if collection is not None: - self.collection = collection - if google_drive_folder is not None: - self.google_drive_folder = google_drive_folder - - @property - def title(self): - """Gets the title of this ScoreCreation. # noqa: E501 - - 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\") # noqa: E501 - - :return: The title of this ScoreCreation. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreCreation. - - 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\") # noqa: E501 - - :param title: The title of this ScoreCreation. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def privacy(self): - """Gets the privacy of this ScoreCreation. # noqa: E501 - - - :return: The privacy of this ScoreCreation. # noqa: E501 - :rtype: ScorePrivacy - """ - return self._privacy - - @privacy.setter - def privacy(self, privacy): - """Sets the privacy of this ScoreCreation. - - - :param privacy: The privacy of this ScoreCreation. # noqa: E501 - :type: ScorePrivacy - """ - if privacy is None: - raise ValueError("Invalid value for `privacy`, must not be `None`") # noqa: E501 - - self._privacy = privacy - - @property - def data(self): - """Gets the data of this ScoreCreation. # noqa: E501 - - - :return: The data of this ScoreCreation. # noqa: E501 - :rtype: ScoreData - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ScoreCreation. - - - :param data: The data of this ScoreCreation. # noqa: E501 - :type: ScoreData - """ - - self._data = data - - @property - def data_encoding(self): - """Gets the data_encoding of this ScoreCreation. # noqa: E501 - - - :return: The data_encoding of this ScoreCreation. # noqa: E501 - :rtype: ScoreDataEncoding - """ - return self._data_encoding - - @data_encoding.setter - def data_encoding(self, data_encoding): - """Sets the data_encoding of this ScoreCreation. - - - :param data_encoding: The data_encoding of this ScoreCreation. # noqa: E501 - :type: ScoreDataEncoding - """ - - self._data_encoding = data_encoding - - @property - def source(self): - """Gets the source of this ScoreCreation. # noqa: E501 - - - :return: The source of this ScoreCreation. # noqa: E501 - :rtype: ScoreSource - """ - return self._source - - @source.setter - def source(self, source): - """Sets the source of this ScoreCreation. - - - :param source: The source of this ScoreCreation. # noqa: E501 - :type: ScoreSource - """ - - self._source = source - - @property - def collection(self): - """Gets the collection of this ScoreCreation. # noqa: E501 - - 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. # noqa: E501 - - :return: The collection of this ScoreCreation. # noqa: E501 - :rtype: str - """ - return self._collection - - @collection.setter - def collection(self, collection): - """Sets the collection of this ScoreCreation. - - 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. # noqa: E501 - - :param collection: The collection of this ScoreCreation. # noqa: E501 - :type: str - """ - - self._collection = collection - - @property - def google_drive_folder(self): - """Gets the google_drive_folder of this ScoreCreation. # noqa: E501 - - 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. # noqa: E501 - - :return: The google_drive_folder of this ScoreCreation. # noqa: E501 - :rtype: str - """ - return self._google_drive_folder - - @google_drive_folder.setter - def google_drive_folder(self, google_drive_folder): - """Sets the google_drive_folder of this ScoreCreation. - - 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. # noqa: E501 - - :param google_drive_folder: The google_drive_folder of this ScoreCreation. # noqa: E501 - :type: str - """ - - self._google_drive_folder = google_drive_folder - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCreation): - return False + # data type: ScoreCreationBuilderData + oneof_schema_1_validator: Optional[ScoreCreationBuilderData] = None + # data type: ScoreCreationFileImport + oneof_schema_2_validator: Optional[ScoreCreationFileImport] = None + # data type: ScoreCreationGoogleDriveImport + oneof_schema_3_validator: Optional[ScoreCreationGoogleDriveImport] = None + actual_instance: Optional[Union[ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport]] = None + one_of_schemas: Set[str] = { "ScoreCreationBuilderData", "ScoreCreationFileImport", "ScoreCreationGoogleDriveImport" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = ScoreCreation.model_construct() + error_messages = [] + match = 0 + # validate data type: ScoreCreationBuilderData + if not isinstance(v, ScoreCreationBuilderData): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationBuilderData`") + else: + match += 1 + # validate data type: ScoreCreationFileImport + if not isinstance(v, ScoreCreationFileImport): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationFileImport`") + else: + match += 1 + # validate data type: ScoreCreationGoogleDriveImport + if not isinstance(v, ScoreCreationGoogleDriveImport): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScoreCreationGoogleDriveImport`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ScoreCreationBuilderData + try: + instance.actual_instance = ScoreCreationBuilderData.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ScoreCreationFileImport + try: + instance.actual_instance = ScoreCreationFileImport.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ScoreCreationGoogleDriveImport + try: + instance.actual_instance = ScoreCreationGoogleDriveImport.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into ScoreCreation with oneOf schemas: ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ScoreCreationBuilderData, ScoreCreationFileImport, ScoreCreationGoogleDriveImport]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_creation_builder_data.py b/flat_api/models/score_creation_builder_data.py new file mode 100644 index 0000000..aaed43e --- /dev/null +++ b/flat_api/models/score_creation_builder_data.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_creation_builder_data_all_of_builder_data import ScoreCreationBuilderDataAllOfBuilderData +from flat_api.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderData(BaseModel): + """ + ScoreCreationBuilderData + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + builder_data: ScoreCreationBuilderDataAllOfBuilderData = Field(alias="builderData") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "builderData"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of builder_data + if self.builder_data: + _dict['builderData'] = self.builder_data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "builderData": ScoreCreationBuilderDataAllOfBuilderData.from_dict(obj["builderData"]) if obj.get("builderData") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_builder_data_all_of_builder_data.py b/flat_api/models/score_creation_builder_data_all_of_builder_data.py new file mode 100644 index 0000000..22ca0ef --- /dev/null +++ b/flat_api/models/score_creation_builder_data_all_of_builder_data.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_creation_builder_data_all_of_builder_data_layout_data import ScoreCreationBuilderDataAllOfBuilderDataLayoutData +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data import ScoreCreationBuilderDataAllOfBuilderDataScoreData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderData(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderData + """ # noqa: E501 + score_data: ScoreCreationBuilderDataAllOfBuilderDataScoreData = Field(alias="scoreData") + layout_data: Optional[ScoreCreationBuilderDataAllOfBuilderDataLayoutData] = Field(default=None, alias="layoutData") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scoreData", "layoutData"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of score_data + if self.score_data: + _dict['scoreData'] = self.score_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of layout_data + if self.layout_data: + _dict['layoutData'] = self.layout_data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scoreData": ScoreCreationBuilderDataAllOfBuilderDataScoreData.from_dict(obj["scoreData"]) if obj.get("scoreData") is not None else None, + "layoutData": ScoreCreationBuilderDataAllOfBuilderDataLayoutData.from_dict(obj["layoutData"]) if obj.get("layoutData") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.py b/flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.py new file mode 100644 index 0000000..3f432e9 --- /dev/null +++ b/flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataLayoutData(BaseModel): + """ + Control the appearance of the score. If missing, default values are used. + """ # noqa: E501 + notes_spacing_coeff: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A float value >= 1 that controls the spacing between notes.", alias="notesSpacingCoeff") + length_unit: Optional[StrictStr] = Field(default='cm', description="The unit to use for layout customizations", alias="lengthUnit") + page_height: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The height of the page in chosen unit (`lengthUnit`).", alias="pageHeight") + page_width: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The width of the page in chosen unit (`lengthUnit`).", alias="pageWidth") + page_margin_top: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The top margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginTop") + page_margin_bottom: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The bottom margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginBottom") + page_margin_left: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The left margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginLeft") + page_margin_right: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The right margin of the page in chosen unit (`lengthUnit`).", alias="pageMarginRight") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["notesSpacingCoeff", "lengthUnit", "pageHeight", "pageWidth", "pageMarginTop", "pageMarginBottom", "pageMarginLeft", "pageMarginRight"] + + @field_validator('length_unit') + def length_unit_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['cm', 'inch']): + raise ValueError("must be one of enum values ('cm', 'inch')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataLayoutData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "notesSpacingCoeff": obj.get("notesSpacingCoeff"), + "lengthUnit": obj.get("lengthUnit") if obj.get("lengthUnit") is not None else 'cm', + "pageHeight": obj.get("pageHeight"), + "pageWidth": obj.get("pageWidth"), + "pageMarginTop": obj.get("pageMarginTop"), + "pageMarginBottom": obj.get("pageMarginBottom"), + "pageMarginLeft": obj.get("pageMarginLeft"), + "pageMarginRight": obj.get("pageMarginRight") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.py b/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.py new file mode 100644 index 0000000..9e4afaf --- /dev/null +++ b/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from flat_api.models.score_creation_builder_data_all_of_builder_data_score_data_instruments import ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataScoreData(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderDataScoreData + """ # noqa: E501 + use_tab_staff: Optional[StrictBool] = Field(default=None, description="true if the TAB staff is displayed with fretted instruments", alias="useTabStaff") + use_chord_grid: Optional[StrictBool] = Field(default=None, description="true if the chord grid must be displayed with fretted instruments", alias="useChordGrid") + fifths: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The key signature of the score (expressed between -7 and 7). Major C is used when the value is not provided.") + nb_beats: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of beats in the measure", alias="nbBeats") + beat_type: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The duration of a beat in the measure", alias="beatType") + instruments: List[ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments] = Field(description="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). ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["useTabStaff", "useChordGrid", "fifths", "nbBeats", "beatType", "instruments"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in instruments (list) + _items = [] + if self.instruments: + for _item_instruments in self.instruments: + if _item_instruments: + _items.append(_item_instruments.to_dict()) + _dict['instruments'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "useTabStaff": obj.get("useTabStaff"), + "useChordGrid": obj.get("useChordGrid"), + "fifths": obj.get("fifths"), + "nbBeats": obj.get("nbBeats"), + "beatType": obj.get("beatType"), + "instruments": [ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments.from_dict(_item) for _item in obj["instruments"]] if obj.get("instruments") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py b/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py new file mode 100644 index 0000000..eca1a93 --- /dev/null +++ b/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments(BaseModel): + """ + ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments + """ # noqa: E501 + group: StrictStr = Field(description="The identifier of the instrument group (e.g. `keyboards`, `brass`)") + instrument: StrictStr = Field(description="The identifier of the instrument (e.g. `piano`, `trumpet`)") + long_name: Optional[StrictStr] = Field(default=None, description="The full name of the instrument", alias="longName") + short_name: Optional[StrictStr] = Field(default=None, description="The abbreviation of the name of the instrument", alias="shortName") + has_quarter_tone: Optional[StrictBool] = Field(default=None, description="True if the part can use quarter tones (prevents the part from having a TAB staff or chord grid)", alias="hasQuarterTone") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["group", "instrument", "longName", "shortName", "hasQuarterTone"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationBuilderDataAllOfBuilderDataScoreDataInstruments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "group": obj.get("group"), + "instrument": obj.get("instrument"), + "longName": obj.get("longName"), + "shortName": obj.get("shortName"), + "hasQuarterTone": obj.get("hasQuarterTone") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_common.py b/flat_api/models/score_creation_common.py new file mode 100644 index 0000000..bec3925 --- /dev/null +++ b/flat_api/models/score_creation_common.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationCommon(BaseModel): + """ + ScoreCreationCommon + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationCommon from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationCommon from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_file_import.py b/flat_api/models/score_creation_file_import.py new file mode 100644 index 0000000..a4c884a --- /dev/null +++ b/flat_api/models/score_creation_file_import.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationFileImport(BaseModel): + """ + ScoreCreationFileImport + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + filename: Optional[StrictStr] = Field(default=None, description="If this is an imported file, its filename") + data: StrictStr = Field(description="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: Optional[StrictStr] = Field(default=None, description="The optional encoding of the score data. This property must match the encoding used for the `data` property.", alias="dataEncoding") + supports_tasks: Optional[StrictBool] = Field(default=None, description="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}`. ", alias="supportsTasks") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "filename", "data", "dataEncoding", "supportsTasks"] + + @field_validator('data_encoding') + def data_encoding_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['base64']): + raise ValueError("must be one of enum values ('base64')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationFileImport from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationFileImport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "filename": obj.get("filename"), + "data": obj.get("data"), + "dataEncoding": obj.get("dataEncoding"), + "supportsTasks": obj.get("supportsTasks") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_google_drive_import.py b/flat_api/models/score_creation_google_drive_import.py new file mode 100644 index 0000000..6c32f61 --- /dev/null +++ b/flat_api/models/score_creation_google_drive_import.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_privacy import ScorePrivacy +from flat_api.models.score_source import ScoreSource +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreCreationGoogleDriveImport(BaseModel): + """ + ScoreCreationGoogleDriveImport + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="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\") ") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_folder: Optional[StrictStr] = Field(default=None, description="If the user uses Google Drive and this property is specified, the file will be created in this directory. The user creating the file must have write access to this directory. ", alias="googleDriveFolder") + source: ScoreSource + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "privacy", "collection", "googleDriveFolder", "source"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreCreationGoogleDriveImport from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreCreationGoogleDriveImport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "collection": obj.get("collection"), + "googleDriveFolder": obj.get("googleDriveFolder"), + "source": ScoreSource.from_dict(obj["source"]) if obj.get("source") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_creation_type.py b/flat_api/models/score_creation_type.py index bb3c2eb..4341a97 100644 --- a/flat_api/models/score_creation_type.py +++ b/flat_api/models/score_creation_type.py @@ -3,89 +3,37 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ScoreCreationType(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ScoreCreationType(str, Enum): """ - allowed enum values + The type of creation (an original, an arrangement) """ - ORIGINAL = "original" - ARRANGEMENT = "arrangement" - OTHER = "other" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreCreationType - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + ORIGINAL = 'original' + ARRANGEMENT = 'arrangement' + OTHER = 'other' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreCreationType): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreCreationType from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_data.py b/flat_api/models/score_data.py deleted file mode 100644 index f5e8438..0000000 --- a/flat_api/models/score_data.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ScoreData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreData - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_data_encoding.py b/flat_api/models/score_data_encoding.py deleted file mode 100644 index ea9de9c..0000000 --- a/flat_api/models/score_data_encoding.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class ScoreDataEncoding(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - BASE64 = "base64" - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreDataEncoding - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreDataEncoding): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_details.py b/flat_api/models/score_details.py index a73d082..17ac899 100644 --- a/flat_api/models/score_details.py +++ b/flat_api/models/score_details.py @@ -3,891 +3,227 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.resource_collaborator import ResourceCollaborator # noqa: F401,E501 -from flat_api.models.resource_rights import ResourceRights # noqa: F401,E501 -from flat_api.models.score_comments_counts import ScoreCommentsCounts # noqa: F401,E501 -from flat_api.models.score_creation_type import ScoreCreationType # noqa: F401,E501 -from flat_api.models.score_license import ScoreLicense # noqa: F401,E501 -from flat_api.models.score_likes_counts import ScoreLikesCounts # noqa: F401,E501 -from flat_api.models.score_privacy import ScorePrivacy # noqa: F401,E501 -from flat_api.models.score_summary import ScoreSummary # noqa: F401,E501 -from flat_api.models.score_views_counts import ScoreViewsCounts # noqa: F401,E501 -from flat_api.models.user_public_summary import UserPublicSummary # noqa: F401,E501 - - -class ScoreDetails(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from flat_api.models.resource_collaborator import ResourceCollaborator +from flat_api.models.resource_rights import ResourceRights +from flat_api.models.score_comments_counts import ScoreCommentsCounts +from flat_api.models.score_creation_type import ScoreCreationType +from flat_api.models.score_details_all_of_me import ScoreDetailsAllOfMe +from flat_api.models.score_license import ScoreLicense +from flat_api.models.score_likes_counts import ScoreLikesCounts +from flat_api.models.score_plays_counts import ScorePlaysCounts +from flat_api.models.score_privacy import ScorePrivacy +from flat_api.models.score_views_counts import ScoreViewsCounts +from flat_api.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreDetails(BaseModel): """ + The score and all its details + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score") + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the score (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + title: StrictStr = Field(description="The title of the score") + privacy: ScorePrivacy + user: UserPublic + html_url: StrictStr = Field(description="The url where the score can be viewed in a web browser", alias="htmlUrl") + edit_html_url: StrictStr = Field(description="The url where the score can be edited in a web browser", alias="editHtmlUrl") + subtitle: Optional[StrictStr] = Field(default=None, description="Subtitle of the score") + lyricist: Optional[StrictStr] = Field(default=None, description="Lyricist of the score") + arranger: Optional[StrictStr] = Field(default=None, description="Arranger of the score") + composer: Optional[StrictStr] = Field(default=None, description="Composer of the score") + description: Optional[StrictStr] = Field(default=None, description="Description of the creation") + tags: Optional[List[Annotated[str, Field(strict=True)]]] = Field(default=None, description="Tags describing the score") + creation_type: Optional[ScoreCreationType] = Field(default=None, alias="creationType") + license: Optional[ScoreLicense] = None + license_text: Optional[StrictStr] = Field(default=None, description="Additional license text written on the exported/printed score", alias="licenseText") + duration_time: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="In seconds, an approximate duration of the score", alias="durationTime") + number_measures: Optional[StrictInt] = Field(default=None, description="The number of measures in the score", alias="numberMeasures") + main_tempo_qpm: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The main tempo of the score (in QPM)", alias="mainTempoQpm") + main_key_signature: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The main key signature of the score (expressed between -7 and 7).", alias="mainKeySignature") + rights: Optional[ResourceRights] = None + collaborators: List[ResourceCollaborator] = Field(description="The list of the collaborators of the score") + creation_date: datetime = Field(description="The date when the score was created", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The date of the last revision of the score", alias="modificationDate") + publication_date: Optional[datetime] = Field(default=None, description="The date when the score was published on Flat", alias="publicationDate") + scheduled_deletion_date: Optional[datetime] = Field(default=None, description="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, and can be restored with a paying account up to 90 days. ", alias="scheduledDeletionDate") + highlighted_date: Optional[datetime] = Field(default=None, description="The date when the score was highlighted (featured) on our community", alias="highlightedDate") + organization: Optional[StrictStr] = Field(default=None, description="If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. ") + parent_score: Optional[StrictStr] = Field(default=None, description="If the score has been forked, the unique identifier of the parent score. ", alias="parentScore") + instruments: List[StrictStr] = Field(description="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 Flat's UI or instruments icons. The format of the strings is `{instrument-group}.{instrument-id}`. ") + instruments_names: List[StrictStr] = Field(description="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. ", alias="instrumentsNames") + samples: List[StrictStr] = Field(description="An array of the audio sample identifiers used by the different score parts. The format of the strings is `{instrument-group}.{sample-id}`. ") + google_drive_file_id: Optional[StrictStr] = Field(default=None, description="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}` ", alias="googleDriveFileId") + likes: Optional[ScoreLikesCounts] = None + comments: Optional[ScoreCommentsCounts] = None + views: Optional[ScoreViewsCounts] = None + plays: Optional[ScorePlaysCounts] = None + collections: Optional[List[StrictStr]] = Field(default=None, description="The list of parent collections this score is included in. Please note that you might not have access to all of them.") + me: Optional[ScoreDetailsAllOfMe] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "sharingKey", "title", "privacy", "user", "htmlUrl", "editHtmlUrl", "subtitle", "lyricist", "arranger", "composer", "description", "tags", "creationType", "license", "licenseText", "durationTime", "numberMeasures", "mainTempoQpm", "mainKeySignature", "rights", "collaborators", "creationDate", "modificationDate", "publicationDate", "scheduledDeletionDate", "highlightedDate", "organization", "parentScore", "instruments", "instrumentsNames", "samples", "googleDriveFileId", "likes", "comments", "views", "plays", "collections", "me"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of rights + if self.rights: + _dict['rights'] = self.rights.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collaborators (list) + _items = [] + if self.collaborators: + for _item_collaborators in self.collaborators: + if _item_collaborators: + _items.append(_item_collaborators.to_dict()) + _dict['collaborators'] = _items + # override the default output from pydantic by calling `to_dict()` of likes + if self.likes: + _dict['likes'] = self.likes.to_dict() + # override the default output from pydantic by calling `to_dict()` of comments + if self.comments: + _dict['comments'] = self.comments.to_dict() + # override the default output from pydantic by calling `to_dict()` of views + if self.views: + _dict['views'] = self.views.to_dict() + # override the default output from pydantic by calling `to_dict()` of plays + if self.plays: + _dict['plays'] = self.plays.to_dict() + # override the default output from pydantic by calling `to_dict()` of me + if self.me: + _dict['me'] = self.me.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if creation_type (nullable) is None + # and model_fields_set contains the field + if self.creation_type is None and "creation_type" in self.model_fields_set: + _dict['creationType'] = None + + # set to None if license (nullable) is None + # and model_fields_set contains the field + if self.license is None and "license" in self.model_fields_set: + _dict['license'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "sharingKey": obj.get("sharingKey"), + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "htmlUrl": obj.get("htmlUrl"), + "editHtmlUrl": obj.get("editHtmlUrl"), + "subtitle": obj.get("subtitle"), + "lyricist": obj.get("lyricist"), + "arranger": obj.get("arranger"), + "composer": obj.get("composer"), + "description": obj.get("description"), + "tags": obj.get("tags"), + "creationType": obj.get("creationType"), + "license": obj.get("license"), + "licenseText": obj.get("licenseText"), + "durationTime": obj.get("durationTime"), + "numberMeasures": obj.get("numberMeasures"), + "mainTempoQpm": obj.get("mainTempoQpm"), + "mainKeySignature": obj.get("mainKeySignature"), + "rights": ResourceRights.from_dict(obj["rights"]) if obj.get("rights") is not None else None, + "collaborators": [ResourceCollaborator.from_dict(_item) for _item in obj["collaborators"]] if obj.get("collaborators") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "publicationDate": obj.get("publicationDate"), + "scheduledDeletionDate": obj.get("scheduledDeletionDate"), + "highlightedDate": obj.get("highlightedDate"), + "organization": obj.get("organization"), + "parentScore": obj.get("parentScore"), + "instruments": obj.get("instruments"), + "instrumentsNames": obj.get("instrumentsNames"), + "samples": obj.get("samples"), + "googleDriveFileId": obj.get("googleDriveFileId"), + "likes": ScoreLikesCounts.from_dict(obj["likes"]) if obj.get("likes") is not None else None, + "comments": ScoreCommentsCounts.from_dict(obj["comments"]) if obj.get("comments") is not None else None, + "views": ScoreViewsCounts.from_dict(obj["views"]) if obj.get("views") is not None else None, + "plays": ScorePlaysCounts.from_dict(obj["plays"]) if obj.get("plays") is not None else None, + "collections": obj.get("collections"), + "me": ScoreDetailsAllOfMe.from_dict(obj["me"]) if obj.get("me") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'sharing_key': 'str', - 'title': 'str', - 'privacy': 'ScorePrivacy', - 'user': 'UserPublicSummary', - 'html_url': 'str', - 'subtitle': 'str', - 'lyricist': 'str', - 'composer': 'str', - 'description': 'str', - 'tags': 'list[str]', - 'creation_type': 'ScoreCreationType', - 'license': 'ScoreLicense', - 'license_text': 'str', - 'duration_time': 'int', - 'number_measures': 'int', - 'main_tempo_qpm': 'int', - 'rights': 'ResourceRights', - 'collaborators': 'list[ResourceCollaborator]', - 'creation_date': 'datetime', - 'modification_date': 'datetime', - 'publication_date': 'datetime', - 'organization': 'str', - 'parent_score': 'str', - 'instruments': 'list[str]', - 'google_drive_file_id': 'str', - 'likes': 'ScoreLikesCounts', - 'comments': 'ScoreCommentsCounts', - 'views': 'ScoreViewsCounts' - } - - attribute_map = { - 'id': 'id', - 'sharing_key': 'sharingKey', - 'title': 'title', - 'privacy': 'privacy', - 'user': 'user', - 'html_url': 'htmlUrl', - 'subtitle': 'subtitle', - 'lyricist': 'lyricist', - 'composer': 'composer', - 'description': 'description', - 'tags': 'tags', - 'creation_type': 'creationType', - 'license': 'license', - 'license_text': 'licenseText', - 'duration_time': 'durationTime', - 'number_measures': 'numberMeasures', - 'main_tempo_qpm': 'mainTempoQpm', - 'rights': 'rights', - 'collaborators': 'collaborators', - 'creation_date': 'creationDate', - 'modification_date': 'modificationDate', - 'publication_date': 'publicationDate', - 'organization': 'organization', - 'parent_score': 'parentScore', - 'instruments': 'instruments', - 'google_drive_file_id': 'googleDriveFileId', - 'likes': 'likes', - 'comments': 'comments', - 'views': 'views' - } - - def __init__(self, id=None, sharing_key=None, title=None, privacy=None, user=None, html_url=None, subtitle=None, lyricist=None, composer=None, description=None, tags=None, creation_type=None, license=None, license_text=None, duration_time=None, number_measures=None, main_tempo_qpm=None, rights=None, collaborators=None, creation_date=None, modification_date=None, publication_date=None, organization=None, parent_score=None, instruments=None, google_drive_file_id=None, likes=None, comments=None, views=None): # noqa: E501 - """ScoreDetails - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._sharing_key = None - self._title = None - self._privacy = None - self._user = None - self._html_url = None - self._subtitle = None - self._lyricist = None - self._composer = None - self._description = None - self._tags = None - self._creation_type = None - self._license = None - self._license_text = None - self._duration_time = None - self._number_measures = None - self._main_tempo_qpm = None - self._rights = None - self._collaborators = None - self._creation_date = None - self._modification_date = None - self._publication_date = None - self._organization = None - self._parent_score = None - self._instruments = None - self._google_drive_file_id = None - self._likes = None - self._comments = None - self._views = None - self.discriminator = None - - if id is not None: - self.id = id - if sharing_key is not None: - self.sharing_key = sharing_key - if title is not None: - self.title = title - if privacy is not None: - self.privacy = privacy - if user is not None: - self.user = user - if html_url is not None: - self.html_url = html_url - if subtitle is not None: - self.subtitle = subtitle - if lyricist is not None: - self.lyricist = lyricist - if composer is not None: - self.composer = composer - if description is not None: - self.description = description - if tags is not None: - self.tags = tags - if creation_type is not None: - self.creation_type = creation_type - if license is not None: - self.license = license - if license_text is not None: - self.license_text = license_text - if duration_time is not None: - self.duration_time = duration_time - if number_measures is not None: - self.number_measures = number_measures - if main_tempo_qpm is not None: - self.main_tempo_qpm = main_tempo_qpm - if rights is not None: - self.rights = rights - if collaborators is not None: - self.collaborators = collaborators - if creation_date is not None: - self.creation_date = creation_date - if modification_date is not None: - self.modification_date = modification_date - if publication_date is not None: - self.publication_date = publication_date - if organization is not None: - self.organization = organization - if parent_score is not None: - self.parent_score = parent_score - if instruments is not None: - self.instruments = instruments - if google_drive_file_id is not None: - self.google_drive_file_id = google_drive_file_id - if likes is not None: - self.likes = likes - if comments is not None: - self.comments = comments - if views is not None: - self.views = views - - @property - def id(self): - """Gets the id of this ScoreDetails. # noqa: E501 - - The unique identifier of the score # noqa: E501 - - :return: The id of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScoreDetails. - - The unique identifier of the score # noqa: E501 - - :param id: The id of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def sharing_key(self): - """Gets the sharing_key of this ScoreDetails. # noqa: E501 - - The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :return: The sharing_key of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._sharing_key - - @sharing_key.setter - def sharing_key(self, sharing_key): - """Sets the sharing_key of this ScoreDetails. - - The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :param sharing_key: The sharing_key of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._sharing_key = sharing_key - - @property - def title(self): - """Gets the title of this ScoreDetails. # noqa: E501 - - The title of the score # noqa: E501 - - :return: The title of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreDetails. - - The title of the score # noqa: E501 - - :param title: The title of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def privacy(self): - """Gets the privacy of this ScoreDetails. # noqa: E501 - - - :return: The privacy of this ScoreDetails. # noqa: E501 - :rtype: ScorePrivacy - """ - return self._privacy - - @privacy.setter - def privacy(self, privacy): - """Sets the privacy of this ScoreDetails. - - - :param privacy: The privacy of this ScoreDetails. # noqa: E501 - :type: ScorePrivacy - """ - - self._privacy = privacy - - @property - def user(self): - """Gets the user of this ScoreDetails. # noqa: E501 - - - :return: The user of this ScoreDetails. # noqa: E501 - :rtype: UserPublicSummary - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ScoreDetails. - - - :param user: The user of this ScoreDetails. # noqa: E501 - :type: UserPublicSummary - """ - - self._user = user - - @property - def html_url(self): - """Gets the html_url of this ScoreDetails. # noqa: E501 - - The url where the score can be viewed in a web browser # noqa: E501 - - :return: The html_url of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._html_url - - @html_url.setter - def html_url(self, html_url): - """Sets the html_url of this ScoreDetails. - - The url where the score can be viewed in a web browser # noqa: E501 - - :param html_url: The html_url of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._html_url = html_url - - @property - def subtitle(self): - """Gets the subtitle of this ScoreDetails. # noqa: E501 - - Subtitle of the score # noqa: E501 - - :return: The subtitle of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._subtitle - - @subtitle.setter - def subtitle(self, subtitle): - """Sets the subtitle of this ScoreDetails. - - Subtitle of the score # noqa: E501 - - :param subtitle: The subtitle of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._subtitle = subtitle - - @property - def lyricist(self): - """Gets the lyricist of this ScoreDetails. # noqa: E501 - - Lyricist of the score # noqa: E501 - - :return: The lyricist of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._lyricist - - @lyricist.setter - def lyricist(self, lyricist): - """Sets the lyricist of this ScoreDetails. - - Lyricist of the score # noqa: E501 - - :param lyricist: The lyricist of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._lyricist = lyricist - - @property - def composer(self): - """Gets the composer of this ScoreDetails. # noqa: E501 - - Composer of the score # noqa: E501 - - :return: The composer of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._composer - - @composer.setter - def composer(self, composer): - """Sets the composer of this ScoreDetails. - - Composer of the score # noqa: E501 - - :param composer: The composer of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._composer = composer - - @property - def description(self): - """Gets the description of this ScoreDetails. # noqa: E501 - - Description of the creation # noqa: E501 - - :return: The description of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ScoreDetails. - - Description of the creation # noqa: E501 - - :param description: The description of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def tags(self): - """Gets the tags of this ScoreDetails. # noqa: E501 - - Tags describing the score # noqa: E501 - - :return: The tags of this ScoreDetails. # noqa: E501 - :rtype: list[str] - """ - return self._tags - - @tags.setter - def tags(self, tags): - """Sets the tags of this ScoreDetails. - - Tags describing the score # noqa: E501 - - :param tags: The tags of this ScoreDetails. # noqa: E501 - :type: list[str] - """ - - self._tags = tags - - @property - def creation_type(self): - """Gets the creation_type of this ScoreDetails. # noqa: E501 - - - :return: The creation_type of this ScoreDetails. # noqa: E501 - :rtype: ScoreCreationType - """ - return self._creation_type - - @creation_type.setter - def creation_type(self, creation_type): - """Sets the creation_type of this ScoreDetails. - - - :param creation_type: The creation_type of this ScoreDetails. # noqa: E501 - :type: ScoreCreationType - """ - - self._creation_type = creation_type - - @property - def license(self): - """Gets the license of this ScoreDetails. # noqa: E501 - - - :return: The license of this ScoreDetails. # noqa: E501 - :rtype: ScoreLicense - """ - return self._license - - @license.setter - def license(self, license): - """Sets the license of this ScoreDetails. - - - :param license: The license of this ScoreDetails. # noqa: E501 - :type: ScoreLicense - """ - - self._license = license - - @property - def license_text(self): - """Gets the license_text of this ScoreDetails. # noqa: E501 - - Additional license text written on the exported/printed score # noqa: E501 - - :return: The license_text of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._license_text - - @license_text.setter - def license_text(self, license_text): - """Sets the license_text of this ScoreDetails. - - Additional license text written on the exported/printed score # noqa: E501 - - :param license_text: The license_text of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._license_text = license_text - - @property - def duration_time(self): - """Gets the duration_time of this ScoreDetails. # noqa: E501 - - In seconds, an approximative duration of the score # noqa: E501 - - :return: The duration_time of this ScoreDetails. # noqa: E501 - :rtype: int - """ - return self._duration_time - - @duration_time.setter - def duration_time(self, duration_time): - """Sets the duration_time of this ScoreDetails. - - In seconds, an approximative duration of the score # noqa: E501 - - :param duration_time: The duration_time of this ScoreDetails. # noqa: E501 - :type: int - """ - - self._duration_time = duration_time - - @property - def number_measures(self): - """Gets the number_measures of this ScoreDetails. # noqa: E501 - - The number of measures in the score # noqa: E501 - - :return: The number_measures of this ScoreDetails. # noqa: E501 - :rtype: int - """ - return self._number_measures - - @number_measures.setter - def number_measures(self, number_measures): - """Sets the number_measures of this ScoreDetails. - - The number of measures in the score # noqa: E501 - - :param number_measures: The number_measures of this ScoreDetails. # noqa: E501 - :type: int - """ - - self._number_measures = number_measures - - @property - def main_tempo_qpm(self): - """Gets the main_tempo_qpm of this ScoreDetails. # noqa: E501 - - The main tempo of the score (in QPM) # noqa: E501 - - :return: The main_tempo_qpm of this ScoreDetails. # noqa: E501 - :rtype: int - """ - return self._main_tempo_qpm - - @main_tempo_qpm.setter - def main_tempo_qpm(self, main_tempo_qpm): - """Sets the main_tempo_qpm of this ScoreDetails. - - The main tempo of the score (in QPM) # noqa: E501 - - :param main_tempo_qpm: The main_tempo_qpm of this ScoreDetails. # noqa: E501 - :type: int - """ - - self._main_tempo_qpm = main_tempo_qpm - - @property - def rights(self): - """Gets the rights of this ScoreDetails. # noqa: E501 - - - :return: The rights of this ScoreDetails. # noqa: E501 - :rtype: ResourceRights - """ - return self._rights - - @rights.setter - def rights(self, rights): - """Sets the rights of this ScoreDetails. - - - :param rights: The rights of this ScoreDetails. # noqa: E501 - :type: ResourceRights - """ - - self._rights = rights - - @property - def collaborators(self): - """Gets the collaborators of this ScoreDetails. # noqa: E501 - - The list of the collaborators of the score # noqa: E501 - - :return: The collaborators of this ScoreDetails. # noqa: E501 - :rtype: list[ResourceCollaborator] - """ - return self._collaborators - - @collaborators.setter - def collaborators(self, collaborators): - """Sets the collaborators of this ScoreDetails. - - The list of the collaborators of the score # noqa: E501 - - :param collaborators: The collaborators of this ScoreDetails. # noqa: E501 - :type: list[ResourceCollaborator] - """ - - self._collaborators = collaborators - - @property - def creation_date(self): - """Gets the creation_date of this ScoreDetails. # noqa: E501 - - The date when the score was created # noqa: E501 - - :return: The creation_date of this ScoreDetails. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this ScoreDetails. - - The date when the score was created # noqa: E501 - - :param creation_date: The creation_date of this ScoreDetails. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def modification_date(self): - """Gets the modification_date of this ScoreDetails. # noqa: E501 - - The date of the last revision of the score # noqa: E501 - - :return: The modification_date of this ScoreDetails. # noqa: E501 - :rtype: datetime - """ - return self._modification_date - - @modification_date.setter - def modification_date(self, modification_date): - """Sets the modification_date of this ScoreDetails. - - The date of the last revision of the score # noqa: E501 - - :param modification_date: The modification_date of this ScoreDetails. # noqa: E501 - :type: datetime - """ - - self._modification_date = modification_date - - @property - def publication_date(self): - """Gets the publication_date of this ScoreDetails. # noqa: E501 - - The date when the score was published on Flat # noqa: E501 - - :return: The publication_date of this ScoreDetails. # noqa: E501 - :rtype: datetime - """ - return self._publication_date - - @publication_date.setter - def publication_date(self, publication_date): - """Sets the publication_date of this ScoreDetails. - - The date when the score was published on Flat # noqa: E501 - - :param publication_date: The publication_date of this ScoreDetails. # noqa: E501 - :type: datetime - """ - - self._publication_date = publication_date - - @property - def organization(self): - """Gets the organization of this ScoreDetails. # noqa: E501 - - If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. # noqa: E501 - - :return: The organization of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this ScoreDetails. - - If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy `organizationPublic`. # noqa: E501 - - :param organization: The organization of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def parent_score(self): - """Gets the parent_score of this ScoreDetails. # noqa: E501 - - If the score has been forked, the unique identifier of the parent score. # noqa: E501 - - :return: The parent_score of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._parent_score - - @parent_score.setter - def parent_score(self, parent_score): - """Sets the parent_score of this ScoreDetails. - - If the score has been forked, the unique identifier of the parent score. # noqa: E501 - - :param parent_score: The parent_score of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._parent_score = parent_score - - @property - def instruments(self): - """Gets the instruments of this ScoreDetails. # noqa: E501 - - 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}`. # noqa: E501 - - :return: The instruments of this ScoreDetails. # noqa: E501 - :rtype: list[str] - """ - return self._instruments - - @instruments.setter - def instruments(self, instruments): - """Sets the instruments of this ScoreDetails. - - 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}`. # noqa: E501 - - :param instruments: The instruments of this ScoreDetails. # noqa: E501 - :type: list[str] - """ - - self._instruments = instruments - - @property - def google_drive_file_id(self): - """Gets the google_drive_file_id of this ScoreDetails. # noqa: E501 - - 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}` # noqa: E501 - - :return: The google_drive_file_id of this ScoreDetails. # noqa: E501 - :rtype: str - """ - return self._google_drive_file_id - - @google_drive_file_id.setter - def google_drive_file_id(self, google_drive_file_id): - """Sets the google_drive_file_id of this ScoreDetails. - - 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}` # noqa: E501 - - :param google_drive_file_id: The google_drive_file_id of this ScoreDetails. # noqa: E501 - :type: str - """ - - self._google_drive_file_id = google_drive_file_id - - @property - def likes(self): - """Gets the likes of this ScoreDetails. # noqa: E501 - - - :return: The likes of this ScoreDetails. # noqa: E501 - :rtype: ScoreLikesCounts - """ - return self._likes - - @likes.setter - def likes(self, likes): - """Sets the likes of this ScoreDetails. - - - :param likes: The likes of this ScoreDetails. # noqa: E501 - :type: ScoreLikesCounts - """ - - self._likes = likes - - @property - def comments(self): - """Gets the comments of this ScoreDetails. # noqa: E501 - - - :return: The comments of this ScoreDetails. # noqa: E501 - :rtype: ScoreCommentsCounts - """ - return self._comments - - @comments.setter - def comments(self, comments): - """Sets the comments of this ScoreDetails. - - - :param comments: The comments of this ScoreDetails. # noqa: E501 - :type: ScoreCommentsCounts - """ - - self._comments = comments - - @property - def views(self): - """Gets the views of this ScoreDetails. # noqa: E501 - - - :return: The views of this ScoreDetails. # noqa: E501 - :rtype: ScoreViewsCounts - """ - return self._views - - @views.setter - def views(self, views): - """Sets the views of this ScoreDetails. - - - :param views: The views of this ScoreDetails. # noqa: E501 - :type: ScoreViewsCounts - """ - - self._views = views - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreDetails): - return False - - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_details_all_of_me.py b/flat_api/models/score_details_all_of_me.py new file mode 100644 index 0000000..7483e8a --- /dev/null +++ b/flat_api/models/score_details_all_of_me.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreDetailsAllOfMe(BaseModel): + """ + Information about the authenticated user and this score + """ # noqa: E501 + is_liked: StrictBool = Field(description="True if the current user likes this score", alias="isLiked") + is_in_library: StrictBool = Field(description="True if the score is stored in one of the user's collections", alias="isInLibrary") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["isLiked", "isInLibrary"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreDetailsAllOfMe from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreDetailsAllOfMe from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "isLiked": obj.get("isLiked"), + "isInLibrary": obj.get("isInLibrary") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_fork.py b/flat_api/models/score_fork.py index 285c004..79dd158 100644 --- a/flat_api/models/score_fork.py +++ b/flat_api/models/score_fork.py @@ -3,112 +3,109 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreFork(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreFork(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'collection': 'str' - } - - attribute_map = { - 'collection': 'collection' - } - - def __init__(self, collection=None): # noqa: E501 - """ScoreFork - a model defined in Swagger""" # noqa: E501 - - self._collection = None - self.discriminator = None - - if collection is not None: - self.collection = collection - - @property - def collection(self): - """Gets the collection of this ScoreFork. # noqa: E501 - - 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. # noqa: E501 - - :return: The collection of this ScoreFork. # noqa: E501 - :rtype: str + Options to fork the score + """ # noqa: E501 + collection: Optional[StrictStr] = Field(default=None, description="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. ") + google_drive_disabled: Optional[StrictBool] = Field(default=False, description="If set to `true`, the API won't create the score on Google Drive ", alias="googleDriveDisabled") + keep_original_title: Optional[StrictBool] = Field(default=None, description="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). ", alias="keepOriginalTitle") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collection", "googleDriveDisabled", "keepOriginalTitle"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreFork from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._collection - - @collection.setter - def collection(self, collection): - """Sets the collection of this ScoreFork. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if collection (nullable) is None + # and model_fields_set contains the field + if self.collection is None and "collection" in self.model_fields_set: + _dict['collection'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreFork from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collection": obj.get("collection"), + "googleDriveDisabled": obj.get("googleDriveDisabled") if obj.get("googleDriveDisabled") is not None else False, + "keepOriginalTitle": obj.get("keepOriginalTitle") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - 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. # noqa: E501 - - :param collection: The collection of this ScoreFork. # noqa: E501 - :type: str - """ - self._collection = collection - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreFork): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_license.py b/flat_api/models/score_license.py index 4f3cb16..64e27fe 100644 --- a/flat_api/models/score_license.py +++ b/flat_api/models/score_license.py @@ -3,94 +3,42 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ScoreLicense(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ScoreLicense(str, Enum): """ - allowed enum values + License of the creation. Read more about the Creative Commons licenses on https://creativecommons.org/licenses/ """ - COPYRIGHT = "copyright" - CC0 = "cc0" - CC_BY = "cc-by" - CC_BY_SA = "cc-by-sa" - CC_BY_ND = "cc-by-nd" - CC_BY_NC = "cc-by-nc" - CC_BY_NC_SA = "cc-by-nc-sa" - CC_BY_NC_ND = "cc-by-nc-nd" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreLicense - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + COPYRIGHT = 'copyright' + CC0 = 'cc0' + CC_MINUS_BY = 'cc-by' + CC_MINUS_BY_MINUS_SA = 'cc-by-sa' + CC_MINUS_BY_MINUS_ND = 'cc-by-nd' + CC_MINUS_BY_MINUS_NC = 'cc-by-nc' + CC_MINUS_BY_MINUS_NC_MINUS_SA = 'cc-by-nc-sa' + CC_MINUS_BY_MINUS_NC_MINUS_ND = 'cc-by-nc-nd' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreLicense): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreLicense from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_likes_counts.py b/flat_api/models/score_likes_counts.py index 107d2fb..0ceffd3 100644 --- a/flat_api/models/score_likes_counts.py +++ b/flat_api/models/score_likes_counts.py @@ -3,168 +3,106 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreLikesCounts(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreLikesCounts(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'total': 'float', - 'weekly': 'float', - 'monthly': 'float' - } - - attribute_map = { - 'total': 'total', - 'weekly': 'weekly', - 'monthly': 'monthly' - } - - def __init__(self, total=None, weekly=None, monthly=None): # noqa: E501 - """ScoreLikesCounts - a model defined in Swagger""" # noqa: E501 - - self._total = None - self._weekly = None - self._monthly = None - self.discriminator = None - - if total is not None: - self.total = total - if weekly is not None: - self.weekly = weekly - if monthly is not None: - self.monthly = monthly - - @property - def total(self): - """Gets the total of this ScoreLikesCounts. # noqa: E501 - - The total number of likes of the score # noqa: E501 - - :return: The total of this ScoreLikesCounts. # noqa: E501 - :rtype: float - """ - return self._total - - @total.setter - def total(self, total): - """Sets the total of this ScoreLikesCounts. - - The total number of likes of the score # noqa: E501 - - :param total: The total of this ScoreLikesCounts. # noqa: E501 - :type: float - """ - - self._total = total - - @property - def weekly(self): - """Gets the weekly of this ScoreLikesCounts. # noqa: E501 - - The number of new likes during the last week # noqa: E501 - - :return: The weekly of this ScoreLikesCounts. # noqa: E501 - :rtype: float - """ - return self._weekly - - @weekly.setter - def weekly(self, weekly): - """Sets the weekly of this ScoreLikesCounts. - - The number of new likes during the last week # noqa: E501 - - :param weekly: The weekly of this ScoreLikesCounts. # noqa: E501 - :type: float + A computed version of the weekly, monthly, yearly and total number of likes for a score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of likes of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last week") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last month") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of new likes during the last year") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreLikesCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreLikesCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._weekly = weekly - - @property - def monthly(self): - """Gets the monthly of this ScoreLikesCounts. # noqa: E501 - - The number of new likes during the last month # noqa: E501 - - :return: The monthly of this ScoreLikesCounts. # noqa: E501 - :rtype: float - """ - return self._monthly - - @monthly.setter - def monthly(self, monthly): - """Sets the monthly of this ScoreLikesCounts. - - The number of new likes during the last month # noqa: E501 - - :param monthly: The monthly of this ScoreLikesCounts. # noqa: E501 - :type: float - """ - self._monthly = monthly - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreLikesCounts): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_modification.py b/flat_api/models/score_modification.py index 99d1185..632adba 100644 --- a/flat_api/models/score_modification.py +++ b/flat_api/models/score_modification.py @@ -3,279 +3,176 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.resource_sharing_key import ResourceSharingKey # noqa: F401,E501 -from flat_api.models.score_creation_type import ScoreCreationType # noqa: F401,E501 -from flat_api.models.score_license import ScoreLicense # noqa: F401,E501 -from flat_api.models.score_privacy import ScorePrivacy # noqa: F401,E501 - - -class ScoreModification(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.score_creation_type import ScoreCreationType +from flat_api.models.score_license import ScoreLicense +from flat_api.models.score_privacy import ScorePrivacy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreModification(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'title': 'str', - 'privacy': 'ScorePrivacy', - 'sharing_key': 'ResourceSharingKey', - 'description': 'str', - 'tags': 'list[str]', - 'creation_type': 'ScoreCreationType', - 'license': 'ScoreLicense' - } - - attribute_map = { - 'title': 'title', - 'privacy': 'privacy', - 'sharing_key': 'sharingKey', - 'description': 'description', - 'tags': 'tags', - 'creation_type': 'creationType', - 'license': 'license' - } - - def __init__(self, title=None, privacy=None, sharing_key=None, description=None, tags=None, creation_type=None, license=None): # noqa: E501 - """ScoreModification - a model defined in Swagger""" # noqa: E501 - - self._title = None - self._privacy = None - self._sharing_key = None - self._description = None - self._tags = None - self._creation_type = None - self._license = None - self.discriminator = None - - if title is not None: - self.title = title - if privacy is not None: - self.privacy = privacy - if sharing_key is not None: - self.sharing_key = sharing_key - if description is not None: - self.description = description - if tags is not None: - self.tags = tags - if creation_type is not None: - self.creation_type = creation_type - if license is not None: - self.license = license - - @property - def title(self): - """Gets the title of this ScoreModification. # noqa: E501 - - The title of the score # noqa: E501 - - :return: The title of this ScoreModification. # noqa: E501 - :rtype: str + Edit the score metadata + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="The title of the score") + subtitle: Optional[StrictStr] = Field(default=None, description="The subtitle of the score") + composer: Optional[StrictStr] = Field(default=None, description="The composer of the score") + lyricist: Optional[StrictStr] = Field(default=None, description="The lyricist of the score") + arranger: Optional[StrictStr] = Field(default=None, description="The arranger of the score") + privacy: Optional[ScorePrivacy] = ScorePrivacy.PRIVATE + sharing_key: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="When using the `privacy` mode `privateLink`, this property can be used to set a custom sharing key, otherwise a new key will be generated.", alias="sharingKey") + description: Optional[Annotated[str, Field(strict=True, max_length=2000)]] = Field(default=None, description="Description of the creation") + tags: Optional[List[StrictStr]] = Field(default=None, description="Tags describing the score") + creation_type: Optional[ScoreCreationType] = Field(default=None, alias="creationType") + license: Optional[ScoreLicense] = None + license_text: Optional[StrictStr] = Field(default=None, description="The rights info written on the score", alias="licenseText") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "subtitle", "composer", "lyricist", "arranger", "privacy", "sharingKey", "description", "tags", "creationType", "license", "licenseText"] + + @field_validator('sharing_key', mode="before") + def sharing_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^[a-f0-9]{128}$", value): + raise ValueError(r"must validate the regular expression /^[a-f0-9]{128}$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreModification from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreModification. - - The title of the score # noqa: E501 - - :param title: The title of this ScoreModification. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def privacy(self): - """Gets the privacy of this ScoreModification. # noqa: E501 - - - :return: The privacy of this ScoreModification. # noqa: E501 - :rtype: ScorePrivacy - """ - return self._privacy - - @privacy.setter - def privacy(self, privacy): - """Sets the privacy of this ScoreModification. - - - :param privacy: The privacy of this ScoreModification. # noqa: E501 - :type: ScorePrivacy - """ - - self._privacy = privacy - - @property - def sharing_key(self): - """Gets the sharing_key of this ScoreModification. # noqa: E501 - - - :return: The sharing_key of this ScoreModification. # noqa: E501 - :rtype: ResourceSharingKey - """ - return self._sharing_key - - @sharing_key.setter - def sharing_key(self, sharing_key): - """Sets the sharing_key of this ScoreModification. - - - :param sharing_key: The sharing_key of this ScoreModification. # noqa: E501 - :type: ResourceSharingKey - """ - - self._sharing_key = sharing_key + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if subtitle (nullable) is None + # and model_fields_set contains the field + if self.subtitle is None and "subtitle" in self.model_fields_set: + _dict['subtitle'] = None + + # set to None if composer (nullable) is None + # and model_fields_set contains the field + if self.composer is None and "composer" in self.model_fields_set: + _dict['composer'] = None + + # set to None if lyricist (nullable) is None + # and model_fields_set contains the field + if self.lyricist is None and "lyricist" in self.model_fields_set: + _dict['lyricist'] = None + + # set to None if arranger (nullable) is None + # and model_fields_set contains the field + if self.arranger is None and "arranger" in self.model_fields_set: + _dict['arranger'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if creation_type (nullable) is None + # and model_fields_set contains the field + if self.creation_type is None and "creation_type" in self.model_fields_set: + _dict['creationType'] = None + + # set to None if license (nullable) is None + # and model_fields_set contains the field + if self.license is None and "license" in self.model_fields_set: + _dict['license'] = None + + # set to None if license_text (nullable) is None + # and model_fields_set contains the field + if self.license_text is None and "license_text" in self.model_fields_set: + _dict['licenseText'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreModification from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "subtitle": obj.get("subtitle"), + "composer": obj.get("composer"), + "lyricist": obj.get("lyricist"), + "arranger": obj.get("arranger"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "sharingKey": obj.get("sharingKey"), + "description": obj.get("description"), + "tags": obj.get("tags"), + "creationType": obj.get("creationType"), + "license": obj.get("license"), + "licenseText": obj.get("licenseText") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @property - def description(self): - """Gets the description of this ScoreModification. # noqa: E501 - - Description of the creation # noqa: E501 - - :return: The description of this ScoreModification. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ScoreModification. - - Description of the creation # noqa: E501 - - :param description: The description of this ScoreModification. # noqa: E501 - :type: str - """ - if description is not None and len(description) > 1000: - raise ValueError("Invalid value for `description`, length must be less than or equal to `1000`") # noqa: E501 - - self._description = description - - @property - def tags(self): - """Gets the tags of this ScoreModification. # noqa: E501 - - Tags describing the score # noqa: E501 - - :return: The tags of this ScoreModification. # noqa: E501 - :rtype: list[str] - """ - return self._tags - - @tags.setter - def tags(self, tags): - """Sets the tags of this ScoreModification. - - Tags describing the score # noqa: E501 - - :param tags: The tags of this ScoreModification. # noqa: E501 - :type: list[str] - """ - - self._tags = tags - - @property - def creation_type(self): - """Gets the creation_type of this ScoreModification. # noqa: E501 - - - :return: The creation_type of this ScoreModification. # noqa: E501 - :rtype: ScoreCreationType - """ - return self._creation_type - - @creation_type.setter - def creation_type(self, creation_type): - """Sets the creation_type of this ScoreModification. - - - :param creation_type: The creation_type of this ScoreModification. # noqa: E501 - :type: ScoreCreationType - """ - - self._creation_type = creation_type - - @property - def license(self): - """Gets the license of this ScoreModification. # noqa: E501 - - - :return: The license of this ScoreModification. # noqa: E501 - :rtype: ScoreLicense - """ - return self._license - - @license.setter - def license(self, license): - """Sets the license of this ScoreModification. - - - :param license: The license of this ScoreModification. # noqa: E501 - :type: ScoreLicense - """ - self._license = license - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreModification): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_plays_counts.py b/flat_api/models/score_plays_counts.py new file mode 100644 index 0000000..eb79ac5 --- /dev/null +++ b/flat_api/models/score_plays_counts.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScorePlaysCounts(BaseModel): + """ + A computed version of the total, weekly, monthly, and yearly number of plays of the score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of plays of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly number of plays of the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly number of plays of the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly number of plays of the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScorePlaysCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScorePlaysCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_privacy.py b/flat_api/models/score_privacy.py index 3b0cfd0..76bc05f 100644 --- a/flat_api/models/score_privacy.py +++ b/flat_api/models/score_privacy.py @@ -3,90 +3,38 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ScorePrivacy(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ScorePrivacy(str, Enum): """ - allowed enum values + The score main privacy mode. - `public`: The score is public on the Internet. This one can be accessible at the url `https://flat.io/score/{score}` and can be modified and administered by specified collaborators users. - `private`: The score is private and can be only accessed, modified and administered by specified collaborators users. - `privateLink`: The score is private but can be accessed using a private link `htmlUrl` or the private key in the property `sharingKey`. - `organizationPublic`: _Available only with [Flat for Education](https://flat.io/edu)._ The score is public in the organization: users of the same organization can access it. The score can be modified and administered by specified collaborators users. The score can also be individually shared to a set of users or groups using the different collaborators API methods. When a file is synchronized from an external source (e.g. Google Drive) and the sharing options are changed on the source, Flat will choose the best privacy mode for the file. When using a [Flat for Education](https://flat.io/edu) account, some of the modes may not be available if disabled by an administrator of the organization (e.g. by default the `public` mode is not available). """ - PUBLIC = "public" - PRIVATE = "private" - ORGANIZATIONPUBLIC = "organizationPublic" - PRIVATELINK = "privateLink" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScorePrivacy - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + PUBLIC = 'public' + PRIVATE = 'private' + ORGANIZATIONPUBLIC = 'organizationPublic' + PRIVATELINK = 'privateLink' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScorePrivacy): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScorePrivacy from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_revision.py b/flat_api/models/score_revision.py index 058bd42..1d7557f 100644 --- a/flat_api/models/score_revision.py +++ b/flat_api/models/score_revision.py @@ -3,278 +3,121 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.score_revision_statistics import ScoreRevisionStatistics # noqa: F401,E501 - - -class ScoreRevision(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_revision_statistics import ScoreRevisionStatistics +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreRevision(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'user': 'str', - 'collaborators': 'list[str]', - 'creation_date': 'datetime', - 'description': 'str', - 'autosave': 'bool', - 'statistics': 'ScoreRevisionStatistics' - } - - attribute_map = { - 'id': 'id', - 'user': 'user', - 'collaborators': 'collaborators', - 'creation_date': 'creationDate', - 'description': 'description', - 'autosave': 'autosave', - 'statistics': 'statistics' - } - - def __init__(self, id=None, user=None, collaborators=None, creation_date=None, description=None, autosave=None, statistics=None): # noqa: E501 - """ScoreRevision - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._user = None - self._collaborators = None - self._creation_date = None - self._description = None - self._autosave = None - self._statistics = None - self.discriminator = None - - if id is not None: - self.id = id - if user is not None: - self.user = user - if collaborators is not None: - self.collaborators = collaborators - if creation_date is not None: - self.creation_date = creation_date - if description is not None: - self.description = description - if autosave is not None: - self.autosave = autosave - if statistics is not None: - self.statistics = statistics - - @property - def id(self): - """Gets the id of this ScoreRevision. # noqa: E501 - - The unique identifier of the revision. # noqa: E501 - - :return: The id of this ScoreRevision. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScoreRevision. - - The unique identifier of the revision. # noqa: E501 - - :param id: The id of this ScoreRevision. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def user(self): - """Gets the user of this ScoreRevision. # noqa: E501 - - The user identifier who created the revision # noqa: E501 - - :return: The user of this ScoreRevision. # noqa: E501 - :rtype: str - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ScoreRevision. - - The user identifier who created the revision # noqa: E501 - - :param user: The user of this ScoreRevision. # noqa: E501 - :type: str - """ - - self._user = user - - @property - def collaborators(self): - """Gets the collaborators of this ScoreRevision. # noqa: E501 - - - :return: The collaborators of this ScoreRevision. # noqa: E501 - :rtype: list[str] - """ - return self._collaborators - - @collaborators.setter - def collaborators(self, collaborators): - """Sets the collaborators of this ScoreRevision. - - - :param collaborators: The collaborators of this ScoreRevision. # noqa: E501 - :type: list[str] - """ - - self._collaborators = collaborators - - @property - def creation_date(self): - """Gets the creation_date of this ScoreRevision. # noqa: E501 - - The date when this revision was created # noqa: E501 - - :return: The creation_date of this ScoreRevision. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this ScoreRevision. - - The date when this revision was created # noqa: E501 - - :param creation_date: The creation_date of this ScoreRevision. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def description(self): - """Gets the description of this ScoreRevision. # noqa: E501 - - A description associated to the revision # noqa: E501 - - :return: The description of this ScoreRevision. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ScoreRevision. - - A description associated to the revision # noqa: E501 - - :param description: The description of this ScoreRevision. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def autosave(self): - """Gets the autosave of this ScoreRevision. # noqa: E501 - - True if this revision was automatically generated by Flat and not on purpose by the user. # noqa: E501 - - :return: The autosave of this ScoreRevision. # noqa: E501 - :rtype: bool + A score revision metadata + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the revision.") + user: Optional[StrictStr] = Field(default=None, description="The user identifier who created the revision") + score: StrictStr = Field(description="The score identifier") + collaborators: Optional[List[StrictStr]] = None + var_date: datetime = Field(description="The date when this revision was created", alias="date") + event: Optional[StrictStr] = Field(default=None, description="The last event (action id) of the revision") + description: Optional[StrictStr] = Field(default=None, description="A description associated to the revision") + autosave: Optional[StrictBool] = Field(default=None, description="True if this revision was automatically generated by Flat and not on purpose by the user. ") + statistics: Optional[ScoreRevisionStatistics] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "user", "score", "collaborators", "date", "event", "description", "autosave", "statistics"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevision from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._autosave - - @autosave.setter - def autosave(self, autosave): - """Sets the autosave of this ScoreRevision. - - True if this revision was automatically generated by Flat and not on purpose by the user. # noqa: E501 - - :param autosave: The autosave of this ScoreRevision. # noqa: E501 - :type: bool - """ - - self._autosave = autosave - - @property - def statistics(self): - """Gets the statistics of this ScoreRevision. # noqa: E501 - - - :return: The statistics of this ScoreRevision. # noqa: E501 - :rtype: ScoreRevisionStatistics - """ - return self._statistics - - @statistics.setter - def statistics(self, statistics): - """Sets the statistics of this ScoreRevision. - - - :param statistics: The statistics of this ScoreRevision. # noqa: E501 - :type: ScoreRevisionStatistics - """ - - self._statistics = statistics - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreRevision): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of statistics + if self.statistics: + _dict['statistics'] = self.statistics.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevision from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "user": obj.get("user"), + "score": obj.get("score"), + "collaborators": obj.get("collaborators"), + "date": obj.get("date"), + "event": obj.get("event"), + "description": obj.get("description"), + "autosave": obj.get("autosave"), + "statistics": ScoreRevisionStatistics.from_dict(obj["statistics"]) if obj.get("statistics") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_revision_creation.py b/flat_api/models/score_revision_creation.py index d377d2c..25bb3ae 100644 --- a/flat_api/models/score_revision_creation.py +++ b/flat_api/models/score_revision_creation.py @@ -3,196 +3,116 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.score_data import ScoreData # noqa: F401,E501 -from flat_api.models.score_data_encoding import ScoreDataEncoding # noqa: F401,E501 - +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python -class ScoreRevisionCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +class ScoreRevisionCreation(BaseModel): """ - swagger_types = { - 'data': 'ScoreData', - 'data_encoding': 'ScoreDataEncoding', - 'autosave': 'bool', - 'description': 'str' - } - - attribute_map = { - 'data': 'data', - 'data_encoding': 'dataEncoding', - 'autosave': 'autosave', - 'description': 'description' - } - - def __init__(self, data=None, data_encoding=None, autosave=None, description=None): # noqa: E501 - """ScoreRevisionCreation - a model defined in Swagger""" # noqa: E501 - - self._data = None - self._data_encoding = None - self._autosave = None - self._description = None - self.discriminator = None - - self.data = data - if data_encoding is not None: - self.data_encoding = data_encoding - if autosave is not None: - self.autosave = autosave - if description is not None: - self.description = description - - @property - def data(self): - """Gets the data of this ScoreRevisionCreation. # noqa: E501 - - - :return: The data of this ScoreRevisionCreation. # noqa: E501 - :rtype: ScoreData - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ScoreRevisionCreation. - - - :param data: The data of this ScoreRevisionCreation. # noqa: E501 - :type: ScoreData - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def data_encoding(self): - """Gets the data_encoding of this ScoreRevisionCreation. # noqa: E501 - - - :return: The data_encoding of this ScoreRevisionCreation. # noqa: E501 - :rtype: ScoreDataEncoding - """ - return self._data_encoding - - @data_encoding.setter - def data_encoding(self, data_encoding): - """Sets the data_encoding of this ScoreRevisionCreation. - - - :param data_encoding: The data_encoding of this ScoreRevisionCreation. # noqa: E501 - :type: ScoreDataEncoding - """ - - self._data_encoding = data_encoding - - @property - def autosave(self): - """Gets the autosave of this ScoreRevisionCreation. # noqa: E501 - - Must be set to `true` if the revision was created automatically. # noqa: E501 - - :return: The autosave of this ScoreRevisionCreation. # noqa: E501 - :rtype: bool - """ - return self._autosave - - @autosave.setter - def autosave(self, autosave): - """Sets the autosave of this ScoreRevisionCreation. - - Must be set to `true` if the revision was created automatically. # noqa: E501 - - :param autosave: The autosave of this ScoreRevisionCreation. # noqa: E501 - :type: bool - """ - - self._autosave = autosave - - @property - def description(self): - """Gets the description of this ScoreRevisionCreation. # noqa: E501 - - A description associated to the revision # noqa: E501 - - :return: The description of this ScoreRevisionCreation. # noqa: E501 - :rtype: str + A new created revision + """ # noqa: E501 + data: StrictStr = Field(description="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 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. ", json_schema_extra={"examples": [""]}) + data_encoding: Optional[StrictStr] = Field(default=None, description="The optional encoding of the score data. This property must match the encoding used for the `data` property.", alias="dataEncoding") + autosave: Optional[StrictBool] = Field(default=None, description="Must be set to `true` if the revision was created automatically. ") + description: Optional[StrictStr] = Field(default=None, description="A description associated to the revision") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["data", "dataEncoding", "autosave", "description"] + + @field_validator('data_encoding') + def data_encoding_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['base64']): + raise ValueError("must be one of enum values ('base64')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevisionCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ScoreRevisionCreation. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevisionCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": obj.get("data"), + "dataEncoding": obj.get("dataEncoding"), + "autosave": obj.get("autosave"), + "description": obj.get("description") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - A description associated to the revision # noqa: E501 - - :param description: The description of this ScoreRevisionCreation. # noqa: E501 - :type: str - """ - self._description = description - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreRevisionCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_revision_statistics.py b/flat_api/models/score_revision_statistics.py index a492345..ff0919d 100644 --- a/flat_api/models/score_revision_statistics.py +++ b/flat_api/models/score_revision_statistics.py @@ -3,140 +3,107 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreRevisionStatistics(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreRevisionStatistics(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'additions': 'float', - 'deletions': 'float' - } - - attribute_map = { - 'additions': 'additions', - 'deletions': 'deletions' - } - - def __init__(self, additions=None, deletions=None): # noqa: E501 - """ScoreRevisionStatistics - a model defined in Swagger""" # noqa: E501 - - self._additions = None - self._deletions = None - self.discriminator = None - - if additions is not None: - self.additions = additions - if deletions is not None: - self.deletions = deletions - - @property - def additions(self): - """Gets the additions of this ScoreRevisionStatistics. # noqa: E501 - - The number of additions operations in the last revision # noqa: E501 - - :return: The additions of this ScoreRevisionStatistics. # noqa: E501 - :rtype: float - """ - return self._additions - - @additions.setter - def additions(self, additions): - """Sets the additions of this ScoreRevisionStatistics. - - The number of additions operations in the last revision # noqa: E501 - - :param additions: The additions of this ScoreRevisionStatistics. # noqa: E501 - :type: float - """ - - self._additions = additions - - @property - def deletions(self): - """Gets the deletions of this ScoreRevisionStatistics. # noqa: E501 - - The number of deletions operations in the last revision # noqa: E501 - - :return: The deletions of this ScoreRevisionStatistics. # noqa: E501 - :rtype: float + The statistics related to the score revision (additions and deletions) + """ # noqa: E501 + additions: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of additions operations in the last revision") + deletions: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of deletions operations in the last revision") + start_date: Optional[datetime] = Field(default=None, description="The date of the first action included in this revision", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The date of the latest action included in this revision", alias="endDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["additions", "deletions", "startDate", "endDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreRevisionStatistics from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._deletions + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreRevisionStatistics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "additions": obj.get("additions"), + "deletions": obj.get("deletions"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @deletions.setter - def deletions(self, deletions): - """Sets the deletions of this ScoreRevisionStatistics. - - The number of deletions operations in the last revision # noqa: E501 - - :param deletions: The deletions of this ScoreRevisionStatistics. # noqa: E501 - :type: float - """ - self._deletions = deletions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreRevisionStatistics): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_source.py b/flat_api/models/score_source.py index 295b040..a98f518 100644 --- a/flat_api/models/score_source.py +++ b/flat_api/models/score_source.py @@ -3,112 +3,100 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreSource(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreSource(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'google_drive': 'str' - } - - attribute_map = { - 'google_drive': 'googleDrive' - } - - def __init__(self, google_drive=None): # noqa: E501 - """ScoreSource - a model defined in Swagger""" # noqa: E501 - - self._google_drive = None - self.discriminator = None - - if google_drive is not None: - self.google_drive = google_drive - - @property - def google_drive(self): - """Gets the google_drive of this ScoreSource. # noqa: E501 - - 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. # noqa: E501 - - :return: The google_drive of this ScoreSource. # noqa: E501 - :rtype: str + ScoreSource + """ # noqa: E501 + google_drive: Optional[StrictStr] = Field(default=None, description="If the score is a file on Google Drive, this 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. ", alias="googleDrive") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["googleDrive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreSource from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._google_drive - - @google_drive.setter - def google_drive(self, google_drive): - """Sets the google_drive of this ScoreSource. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "googleDrive": obj.get("googleDrive") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - 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. # noqa: E501 - - :param google_drive: The google_drive of this ScoreSource. # noqa: E501 - :type: str - """ - self._google_drive = google_drive - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreSource): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_summary.py b/flat_api/models/score_summary.py index b3774e8..e4f717f 100644 --- a/flat_api/models/score_summary.py +++ b/flat_api/models/score_summary.py @@ -3,251 +3,115 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.score_privacy import ScorePrivacy # noqa: F401,E501 -from flat_api.models.user_public_summary import UserPublicSummary # noqa: F401,E501 +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_privacy import ScorePrivacy +from flat_api.models.user_public import UserPublic +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class ScoreSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class ScoreSummary(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'sharing_key': 'str', - 'title': 'str', - 'privacy': 'ScorePrivacy', - 'user': 'UserPublicSummary', - 'html_url': 'str' - } - - attribute_map = { - 'id': 'id', - 'sharing_key': 'sharingKey', - 'title': 'title', - 'privacy': 'privacy', - 'user': 'user', - 'html_url': 'htmlUrl' - } - - def __init__(self, id=None, sharing_key=None, title=None, privacy=None, user=None, html_url=None): # noqa: E501 - """ScoreSummary - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._sharing_key = None - self._title = None - self._privacy = None - self._user = None - self._html_url = None - self.discriminator = None - - if id is not None: - self.id = id - if sharing_key is not None: - self.sharing_key = sharing_key - if title is not None: - self.title = title - if privacy is not None: - self.privacy = privacy - if user is not None: - self.user = user - if html_url is not None: - self.html_url = html_url - - @property - def id(self): - """Gets the id of this ScoreSummary. # noqa: E501 - - The unique identifier of the score # noqa: E501 - - :return: The id of this ScoreSummary. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScoreSummary. - - The unique identifier of the score # noqa: E501 - - :param id: The id of this ScoreSummary. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def sharing_key(self): - """Gets the sharing_key of this ScoreSummary. # noqa: E501 - - The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :return: The sharing_key of this ScoreSummary. # noqa: E501 - :rtype: str - """ - return self._sharing_key - - @sharing_key.setter - def sharing_key(self, sharing_key): - """Sets the sharing_key of this ScoreSummary. - - The private sharing key of the score (available when the `privacy` mode is set to `privateLink`) # noqa: E501 - - :param sharing_key: The sharing_key of this ScoreSummary. # noqa: E501 - :type: str - """ - - self._sharing_key = sharing_key - - @property - def title(self): - """Gets the title of this ScoreSummary. # noqa: E501 - - The title of the score # noqa: E501 - - :return: The title of this ScoreSummary. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreSummary. - - The title of the score # noqa: E501 - - :param title: The title of this ScoreSummary. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def privacy(self): - """Gets the privacy of this ScoreSummary. # noqa: E501 - - - :return: The privacy of this ScoreSummary. # noqa: E501 - :rtype: ScorePrivacy + A summary of the score details + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score") + sharing_key: Optional[StrictStr] = Field(default=None, description="The private sharing key of the score (available when the `privacy` mode is set to `privateLink`)", alias="sharingKey") + title: StrictStr = Field(description="The title of the score") + privacy: ScorePrivacy + user: UserPublic + html_url: StrictStr = Field(description="The url where the score can be viewed in a web browser", alias="htmlUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "sharingKey", "title", "privacy", "user", "htmlUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._privacy - - @privacy.setter - def privacy(self, privacy): - """Sets the privacy of this ScoreSummary. - - - :param privacy: The privacy of this ScoreSummary. # noqa: E501 - :type: ScorePrivacy - """ - - self._privacy = privacy - - @property - def user(self): - """Gets the user of this ScoreSummary. # noqa: E501 - + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "sharingKey": obj.get("sharingKey"), + "title": obj.get("title"), + "privacy": obj.get("privacy") if obj.get("privacy") is not None else ScorePrivacy.PRIVATE, + "user": UserPublic.from_dict(obj["user"]) if obj.get("user") is not None else None, + "htmlUrl": obj.get("htmlUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :return: The user of this ScoreSummary. # noqa: E501 - :rtype: UserPublicSummary - """ - return self._user - - @user.setter - def user(self, user): - """Sets the user of this ScoreSummary. - - - :param user: The user of this ScoreSummary. # noqa: E501 - :type: UserPublicSummary - """ - - self._user = user - - @property - def html_url(self): - """Gets the html_url of this ScoreSummary. # noqa: E501 - - The url where the score can be viewed in a web browser # noqa: E501 - - :return: The html_url of this ScoreSummary. # noqa: E501 - :rtype: str - """ - return self._html_url - - @html_url.setter - def html_url(self, html_url): - """Sets the html_url of this ScoreSummary. - - The url where the score can be viewed in a web browser # noqa: E501 - - :param html_url: The html_url of this ScoreSummary. # noqa: E501 - :type: str - """ - self._html_url = html_url - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track.py b/flat_api/models/score_track.py index b5113e5..d1cc583 100644 --- a/flat_api/models/score_track.py +++ b/flat_api/models/score_track.py @@ -3,418 +3,136 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.score_track_point import ScoreTrackPoint # noqa: F401,E501 -from flat_api.models.score_track_state import ScoreTrackState # noqa: F401,E501 -from flat_api.models.score_track_type import ScoreTrackType # noqa: F401,E501 - - -class ScoreTrack(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_track_point import ScoreTrackPoint +from flat_api.models.score_track_purpose import ScoreTrackPurpose +from flat_api.models.score_track_state import ScoreTrackState +from flat_api.models.score_track_type import ScoreTrackType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrack(BaseModel): """ + An audio track for a score + """ # noqa: E501 + id: StrictStr = Field(description="The unique identifier of the score track") + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + score: Optional[StrictStr] = Field(default=None, description="The unique identifier of the score. Absent for Free Record performance submissions, which are recorded without an attached score. ") + creator: StrictStr = Field(description="The unique identifier of the track creator") + creation_date: datetime = Field(description="The creation date of the track", alias="creationDate") + modification_date: datetime = Field(description="The modification date of the track", alias="modificationDate") + default: StrictBool = Field(description="True if the track should be used as default audio source") + state: ScoreTrackState + type: ScoreTrackType + purpose: ScoreTrackPurpose + url: Optional[StrictStr] = Field(default=None, description="The URL of the track") + media_id: Optional[StrictStr] = Field(default=None, description="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` ", alias="mediaId") + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "score", "creator", "creationDate", "modificationDate", "default", "state", "type", "purpose", "url", "mediaId", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrack from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrack from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "score": obj.get("score"), + "creator": obj.get("creator"), + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "type": obj.get("type"), + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "url": obj.get("url"), + "mediaId": obj.get("mediaId"), + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'title': 'str', - 'score': 'str', - 'creator': 'str', - 'creation_date': 'datetime', - 'modification_date': 'datetime', - 'default': 'bool', - 'state': 'ScoreTrackState', - 'type': 'ScoreTrackType', - 'url': 'str', - 'media_id': 'str', - 'synchronization_points': 'list[ScoreTrackPoint]' - } - - attribute_map = { - 'id': 'id', - 'title': 'title', - 'score': 'score', - 'creator': 'creator', - 'creation_date': 'creationDate', - 'modification_date': 'modificationDate', - 'default': 'default', - 'state': 'state', - 'type': 'type', - 'url': 'url', - 'media_id': 'mediaId', - 'synchronization_points': 'synchronizationPoints' - } - - def __init__(self, id=None, title=None, score=None, creator=None, creation_date=None, modification_date=None, default=None, state=None, type=None, url=None, media_id=None, synchronization_points=None): # noqa: E501 - """ScoreTrack - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._title = None - self._score = None - self._creator = None - self._creation_date = None - self._modification_date = None - self._default = None - self._state = None - self._type = None - self._url = None - self._media_id = None - self._synchronization_points = None - self.discriminator = None - - if id is not None: - self.id = id - if title is not None: - self.title = title - if score is not None: - self.score = score - if creator is not None: - self.creator = creator - if creation_date is not None: - self.creation_date = creation_date - if modification_date is not None: - self.modification_date = modification_date - if default is not None: - self.default = default - if state is not None: - self.state = state - if type is not None: - self.type = type - if url is not None: - self.url = url - if media_id is not None: - self.media_id = media_id - if synchronization_points is not None: - self.synchronization_points = synchronization_points - - @property - def id(self): - """Gets the id of this ScoreTrack. # noqa: E501 - - The unique identifier of the score track # noqa: E501 - - :return: The id of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this ScoreTrack. - - The unique identifier of the score track # noqa: E501 - - :param id: The id of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def title(self): - """Gets the title of this ScoreTrack. # noqa: E501 - - Title of the track # noqa: E501 - - :return: The title of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreTrack. - - Title of the track # noqa: E501 - - :param title: The title of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def score(self): - """Gets the score of this ScoreTrack. # noqa: E501 - - The unique identifier of the score # noqa: E501 - - :return: The score of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._score - - @score.setter - def score(self, score): - """Sets the score of this ScoreTrack. - - The unique identifier of the score # noqa: E501 - - :param score: The score of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._score = score - - @property - def creator(self): - """Gets the creator of this ScoreTrack. # noqa: E501 - - The unique identifier of the track creator # noqa: E501 - - :return: The creator of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._creator - - @creator.setter - def creator(self, creator): - """Sets the creator of this ScoreTrack. - - The unique identifier of the track creator # noqa: E501 - - :param creator: The creator of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._creator = creator - - @property - def creation_date(self): - """Gets the creation_date of this ScoreTrack. # noqa: E501 - - The creation date of the track # noqa: E501 - - :return: The creation_date of this ScoreTrack. # noqa: E501 - :rtype: datetime - """ - return self._creation_date - - @creation_date.setter - def creation_date(self, creation_date): - """Sets the creation_date of this ScoreTrack. - - The creation date of the track # noqa: E501 - - :param creation_date: The creation_date of this ScoreTrack. # noqa: E501 - :type: datetime - """ - - self._creation_date = creation_date - - @property - def modification_date(self): - """Gets the modification_date of this ScoreTrack. # noqa: E501 - - The modification date of the track # noqa: E501 - - :return: The modification_date of this ScoreTrack. # noqa: E501 - :rtype: datetime - """ - return self._modification_date - - @modification_date.setter - def modification_date(self, modification_date): - """Sets the modification_date of this ScoreTrack. - - The modification date of the track # noqa: E501 - - :param modification_date: The modification_date of this ScoreTrack. # noqa: E501 - :type: datetime - """ - - self._modification_date = modification_date - - @property - def default(self): - """Gets the default of this ScoreTrack. # noqa: E501 - - True if the track should be used as default audio source # noqa: E501 - - :return: The default of this ScoreTrack. # noqa: E501 - :rtype: bool - """ - return self._default - - @default.setter - def default(self, default): - """Sets the default of this ScoreTrack. - - True if the track should be used as default audio source # noqa: E501 - - :param default: The default of this ScoreTrack. # noqa: E501 - :type: bool - """ - - self._default = default - - @property - def state(self): - """Gets the state of this ScoreTrack. # noqa: E501 - - - :return: The state of this ScoreTrack. # noqa: E501 - :rtype: ScoreTrackState - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this ScoreTrack. - - - :param state: The state of this ScoreTrack. # noqa: E501 - :type: ScoreTrackState - """ - - self._state = state - - @property - def type(self): - """Gets the type of this ScoreTrack. # noqa: E501 - - - :return: The type of this ScoreTrack. # noqa: E501 - :rtype: ScoreTrackType - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ScoreTrack. - - - :param type: The type of this ScoreTrack. # noqa: E501 - :type: ScoreTrackType - """ - - self._type = type - - @property - def url(self): - """Gets the url of this ScoreTrack. # noqa: E501 - - The URL of the track # noqa: E501 - - :return: The url of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this ScoreTrack. - - The URL of the track # noqa: E501 - - :param url: The url of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._url = url - - @property - def media_id(self): - """Gets the media_id of this ScoreTrack. # noqa: E501 - - 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` # noqa: E501 - - :return: The media_id of this ScoreTrack. # noqa: E501 - :rtype: str - """ - return self._media_id - - @media_id.setter - def media_id(self, media_id): - """Sets the media_id of this ScoreTrack. - - 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` # noqa: E501 - - :param media_id: The media_id of this ScoreTrack. # noqa: E501 - :type: str - """ - - self._media_id = media_id - - @property - def synchronization_points(self): - """Gets the synchronization_points of this ScoreTrack. # noqa: E501 - - - :return: The synchronization_points of this ScoreTrack. # noqa: E501 - :rtype: list[ScoreTrackPoint] - """ - return self._synchronization_points - - @synchronization_points.setter - def synchronization_points(self, synchronization_points): - """Sets the synchronization_points of this ScoreTrack. - - - :param synchronization_points: The synchronization_points of this ScoreTrack. # noqa: E501 - :type: list[ScoreTrackPoint] - """ - - self._synchronization_points = synchronization_points - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrack): - return False - - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track_creation.py b/flat_api/models/score_track_creation.py index 3606cb7..0436944 100644 --- a/flat_api/models/score_track_creation.py +++ b/flat_api/models/score_track_creation.py @@ -3,223 +3,120 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.score_track_point import ScoreTrackPoint # noqa: F401,E501 -from flat_api.models.score_track_state import ScoreTrackState # noqa: F401,E501 - - -class ScoreTrackCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_track_point import ScoreTrackPoint +from flat_api.models.score_track_purpose import ScoreTrackPurpose +from flat_api.models.score_track_state import ScoreTrackState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackCreation(BaseModel): """ - swagger_types = { - 'title': 'str', - 'default': 'bool', - 'state': 'ScoreTrackState', - 'url': 'str', - 'synchronization_points': 'list[ScoreTrackPoint]' - } - - attribute_map = { - 'title': 'title', - 'default': 'default', - 'state': 'state', - 'url': 'url', - 'synchronization_points': 'synchronizationPoints' - } - - def __init__(self, title=None, default=None, state=None, url=None, synchronization_points=None): # noqa: E501 - """ScoreTrackCreation - a model defined in Swagger""" # noqa: E501 - - self._title = None - self._default = None - self._state = None - self._url = None - self._synchronization_points = None - self.discriminator = None - - if title is not None: - self.title = title - if default is not None: - self.default = default - if state is not None: - self.state = state - if url is not None: - self.url = url - if synchronization_points is not None: - self.synchronization_points = synchronization_points - - @property - def title(self): - """Gets the title of this ScoreTrackCreation. # noqa: E501 - - Title of the track # noqa: E501 - - :return: The title of this ScoreTrackCreation. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreTrackCreation. - - Title of the track # noqa: E501 - - :param title: The title of this ScoreTrackCreation. # noqa: E501 - :type: str + Creation of a new track. This one must contain the URL of the track or the corresponding file + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + default: Optional[StrictBool] = Field(default=None, description="True if the track should be used as default audio source") + state: Optional[ScoreTrackState] = ScoreTrackState.DRAFT + purpose: Optional[ScoreTrackPurpose] = ScoreTrackPurpose.COMMON + url: Optional[StrictStr] = Field(default=None, description="The URL of the track") + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "default", "state", "purpose", "url", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "url": obj.get("url"), + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._title = title - - @property - def default(self): - """Gets the default of this ScoreTrackCreation. # noqa: E501 - - True if the track should be used as default audio source # noqa: E501 - - :return: The default of this ScoreTrackCreation. # noqa: E501 - :rtype: bool - """ - return self._default - - @default.setter - def default(self, default): - """Sets the default of this ScoreTrackCreation. - - True if the track should be used as default audio source # noqa: E501 - - :param default: The default of this ScoreTrackCreation. # noqa: E501 - :type: bool - """ - - self._default = default - - @property - def state(self): - """Gets the state of this ScoreTrackCreation. # noqa: E501 - - - :return: The state of this ScoreTrackCreation. # noqa: E501 - :rtype: ScoreTrackState - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this ScoreTrackCreation. - - - :param state: The state of this ScoreTrackCreation. # noqa: E501 - :type: ScoreTrackState - """ - - self._state = state - - @property - def url(self): - """Gets the url of this ScoreTrackCreation. # noqa: E501 - - The URL of the track # noqa: E501 - - :return: The url of this ScoreTrackCreation. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this ScoreTrackCreation. - - The URL of the track # noqa: E501 - - :param url: The url of this ScoreTrackCreation. # noqa: E501 - :type: str - """ - - self._url = url - - @property - def synchronization_points(self): - """Gets the synchronization_points of this ScoreTrackCreation. # noqa: E501 - - - :return: The synchronization_points of this ScoreTrackCreation. # noqa: E501 - :rtype: list[ScoreTrackPoint] - """ - return self._synchronization_points - - @synchronization_points.setter - def synchronization_points(self, synchronization_points): - """Sets the synchronization_points of this ScoreTrackCreation. - - - :param synchronization_points: The synchronization_points of this ScoreTrackCreation. # noqa: E501 - :type: list[ScoreTrackPoint] - """ - self._synchronization_points = synchronization_points - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrackCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track_creation_response.py b/flat_api/models/score_track_creation_response.py new file mode 100644 index 0000000..d307ccf --- /dev/null +++ b/flat_api/models/score_track_creation_response.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from flat_api.models.score_track import ScoreTrack +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackCreationResponse(BaseModel): + """ + Response for track creation including optional upload information + """ # noqa: E501 + track: ScoreTrack + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["track"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackCreationResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of track + if self.track: + _dict['track'] = self.track.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackCreationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "track": ScoreTrack.from_dict(obj["track"]) if obj.get("track") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/score_track_point.py b/flat_api/models/score_track_point.py index 538e1e5..d4df106 100644 --- a/flat_api/models/score_track_point.py +++ b/flat_api/models/score_track_point.py @@ -3,176 +3,112 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreTrackPoint(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreTrackPoint(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'type': 'str', - 'measure_uuid': 'str', - 'time': 'float' - } - - attribute_map = { - 'type': 'type', - 'measure_uuid': 'measureUuid', - 'time': 'time' - } - - def __init__(self, type=None, measure_uuid=None, time=None): # noqa: E501 - """ScoreTrackPoint - a model defined in Swagger""" # noqa: E501 - - self._type = None - self._measure_uuid = None - self._time = None - self.discriminator = None - - self.type = type - if measure_uuid is not None: - self.measure_uuid = measure_uuid - self.time = time - - @property - def type(self): - """Gets the type of this ScoreTrackPoint. # noqa: E501 - - The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` # noqa: E501 - - :return: The type of this ScoreTrackPoint. # noqa: E501 - :rtype: str + A track synchronization point + """ # noqa: E501 + type: StrictStr = Field(description="The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid`") + measure_uuid: Optional[UUID] = Field(default=None, description="The measure unique identifier", alias="measureUuid") + time: Union[StrictFloat, StrictInt] = Field(description="The corresponding time in seconds") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "measureUuid", "time"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['measure', 'end']): + raise ValueError("must be one of enum values ('measure', 'end')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackPoint from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ScoreTrackPoint. - - The type of the synchronization point. If the type is `measure`, the measure uuid must be present in `measureUuid` # noqa: E501 - - :param type: The type of this ScoreTrackPoint. # noqa: E501 - :type: str - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - allowed_values = ["measure", "end"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def measure_uuid(self): - """Gets the measure_uuid of this ScoreTrackPoint. # noqa: E501 + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackPoint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "measureUuid": obj.get("measureUuid"), + "time": obj.get("time") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - The measure unique identifier # noqa: E501 - :return: The measure_uuid of this ScoreTrackPoint. # noqa: E501 - :rtype: str - """ - return self._measure_uuid - - @measure_uuid.setter - def measure_uuid(self, measure_uuid): - """Sets the measure_uuid of this ScoreTrackPoint. - - The measure unique identifier # noqa: E501 - - :param measure_uuid: The measure_uuid of this ScoreTrackPoint. # noqa: E501 - :type: str - """ - - self._measure_uuid = measure_uuid - - @property - def time(self): - """Gets the time of this ScoreTrackPoint. # noqa: E501 - - The corresponding time in seconds # noqa: E501 - - :return: The time of this ScoreTrackPoint. # noqa: E501 - :rtype: float - """ - return self._time - - @time.setter - def time(self, time): - """Sets the time of this ScoreTrackPoint. - - The corresponding time in seconds # noqa: E501 - - :param time: The time of this ScoreTrackPoint. # noqa: E501 - :type: float - """ - if time is None: - raise ValueError("Invalid value for `time`, must not be `None`") # noqa: E501 - - self._time = time - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrackPoint): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track_purpose.py b/flat_api/models/score_track_purpose.py new file mode 100644 index 0000000..501b72f --- /dev/null +++ b/flat_api/models/score_track_purpose.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoreTrackPurpose(str, Enum): + """ + The purpose of the audio track + """ + + """ + allowed enum values + """ + COMMON = 'common' + PERFORMANCESUBMISSION = 'performanceSubmission' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackPurpose from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/score_track_state.py b/flat_api/models/score_track_state.py index 7faf2f6..d2f21e1 100644 --- a/flat_api/models/score_track_state.py +++ b/flat_api/models/score_track_state.py @@ -3,89 +3,37 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ScoreTrackState(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ScoreTrackState(str, Enum): """ - allowed enum values + State of the track """ - DRAFT = "draft" - COMPLETED = "completed" - DELETED = "deleted" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreTrackState - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + DRAFT = 'draft' + COMPLETED = 'completed' + DELETED = 'deleted' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrackState): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackState from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track_type.py b/flat_api/models/score_track_type.py index 9953730..d9bd943 100644 --- a/flat_api/models/score_track_type.py +++ b/flat_api/models/score_track_type.py @@ -3,90 +3,38 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import pprint -import re # noqa: F401 - -import six + Do not edit the class manually. +""" # noqa: E501 -class ScoreTrackType(object): - """NOTE: This class is auto generated by the swagger code generator program. +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - Do not edit the class manually. - """ +class ScoreTrackType(str, Enum): """ - allowed enum values + The type of an audio track """ - AUDIO = "audio" - SOUNDCLOUD = "soundcloud" - YOUTUBE = "youtube" - VIMEO = "vimeo" """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. + allowed enum values """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """ScoreTrackType - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() + AUDIO = 'audio' + SOUNDCLOUD = 'soundcloud' + YOUTUBE = 'youtube' + VIMEO = 'vimeo' - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrackType): - return False + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoreTrackType from a JSON string""" + return cls(json.loads(json_str)) - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_track_update.py b/flat_api/models/score_track_update.py index 27ed5d7..c625564 100644 --- a/flat_api/models/score_track_update.py +++ b/flat_api/models/score_track_update.py @@ -3,195 +3,118 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.score_track_point import ScoreTrackPoint # noqa: F401,E501 -from flat_api.models.score_track_state import ScoreTrackState # noqa: F401,E501 - - -class ScoreTrackUpdate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.score_track_point import ScoreTrackPoint +from flat_api.models.score_track_purpose import ScoreTrackPurpose +from flat_api.models.score_track_state import ScoreTrackState +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScoreTrackUpdate(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'title': 'str', - 'default': 'bool', - 'state': 'ScoreTrackState', - 'synchronization_points': 'list[ScoreTrackPoint]' - } - - attribute_map = { - 'title': 'title', - 'default': 'default', - 'state': 'state', - 'synchronization_points': 'synchronizationPoints' - } - - def __init__(self, title=None, default=None, state=None, synchronization_points=None): # noqa: E501 - """ScoreTrackUpdate - a model defined in Swagger""" # noqa: E501 - - self._title = None - self._default = None - self._state = None - self._synchronization_points = None - self.discriminator = None - - if title is not None: - self.title = title - if default is not None: - self.default = default - if state is not None: - self.state = state - if synchronization_points is not None: - self.synchronization_points = synchronization_points - - @property - def title(self): - """Gets the title of this ScoreTrackUpdate. # noqa: E501 - - Title of the track # noqa: E501 - - :return: The title of this ScoreTrackUpdate. # noqa: E501 - :rtype: str - """ - return self._title - - @title.setter - def title(self, title): - """Sets the title of this ScoreTrackUpdate. - - Title of the track # noqa: E501 - - :param title: The title of this ScoreTrackUpdate. # noqa: E501 - :type: str - """ - - self._title = title - - @property - def default(self): - """Gets the default of this ScoreTrackUpdate. # noqa: E501 - - True if the track should be used as default audio source # noqa: E501 - - :return: The default of this ScoreTrackUpdate. # noqa: E501 - :rtype: bool + Update an existing track. + """ # noqa: E501 + title: Optional[StrictStr] = Field(default=None, description="Title of the track") + default: Optional[StrictBool] = Field(default=None, description="True if the track should be used as default audio source") + state: Optional[ScoreTrackState] = ScoreTrackState.DRAFT + purpose: Optional[ScoreTrackPurpose] = ScoreTrackPurpose.COMMON + synchronization_points: Optional[List[ScoreTrackPoint]] = Field(default=None, alias="synchronizationPoints") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "default", "state", "purpose", "synchronizationPoints"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreTrackUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._default + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in synchronization_points (list) + _items = [] + if self.synchronization_points: + for _item_synchronization_points in self.synchronization_points: + if _item_synchronization_points: + _items.append(_item_synchronization_points.to_dict()) + _dict['synchronizationPoints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreTrackUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "default": obj.get("default"), + "state": obj.get("state") if obj.get("state") is not None else ScoreTrackState.DRAFT, + "purpose": obj.get("purpose") if obj.get("purpose") is not None else ScoreTrackPurpose.COMMON, + "synchronizationPoints": [ScoreTrackPoint.from_dict(_item) for _item in obj["synchronizationPoints"]] if obj.get("synchronizationPoints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @default.setter - def default(self, default): - """Sets the default of this ScoreTrackUpdate. - - True if the track should be used as default audio source # noqa: E501 - - :param default: The default of this ScoreTrackUpdate. # noqa: E501 - :type: bool - """ - - self._default = default - - @property - def state(self): - """Gets the state of this ScoreTrackUpdate. # noqa: E501 - - - :return: The state of this ScoreTrackUpdate. # noqa: E501 - :rtype: ScoreTrackState - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this ScoreTrackUpdate. - - - :param state: The state of this ScoreTrackUpdate. # noqa: E501 - :type: ScoreTrackState - """ - - self._state = state - - @property - def synchronization_points(self): - """Gets the synchronization_points of this ScoreTrackUpdate. # noqa: E501 - - - :return: The synchronization_points of this ScoreTrackUpdate. # noqa: E501 - :rtype: list[ScoreTrackPoint] - """ - return self._synchronization_points - - @synchronization_points.setter - def synchronization_points(self, synchronization_points): - """Sets the synchronization_points of this ScoreTrackUpdate. - - - :param synchronization_points: The synchronization_points of this ScoreTrackUpdate. # noqa: E501 - :type: list[ScoreTrackPoint] - """ - self._synchronization_points = synchronization_points - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreTrackUpdate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/score_views_counts.py b/flat_api/models/score_views_counts.py index 63e00e2..674fab2 100644 --- a/flat_api/models/score_views_counts.py +++ b/flat_api/models/score_views_counts.py @@ -3,168 +3,106 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class ScoreViewsCounts(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class ScoreViewsCounts(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'total': 'float', - 'weekly': 'float', - 'monthly': 'float' - } - - attribute_map = { - 'total': 'total', - 'weekly': 'weekly', - 'monthly': 'monthly' - } - - def __init__(self, total=None, weekly=None, monthly=None): # noqa: E501 - """ScoreViewsCounts - a model defined in Swagger""" # noqa: E501 - - self._total = None - self._weekly = None - self._monthly = None - self.discriminator = None - - if total is not None: - self.total = total - if weekly is not None: - self.weekly = weekly - if monthly is not None: - self.monthly = monthly - - @property - def total(self): - """Gets the total of this ScoreViewsCounts. # noqa: E501 - - The total number of views of the score # noqa: E501 - - :return: The total of this ScoreViewsCounts. # noqa: E501 - :rtype: float - """ - return self._total - - @total.setter - def total(self, total): - """Sets the total of this ScoreViewsCounts. - - The total number of views of the score # noqa: E501 - - :param total: The total of this ScoreViewsCounts. # noqa: E501 - :type: float - """ - - self._total = total - - @property - def weekly(self): - """Gets the weekly of this ScoreViewsCounts. # noqa: E501 - - The weekly number of views of the score # noqa: E501 - - :return: The weekly of this ScoreViewsCounts. # noqa: E501 - :rtype: float - """ - return self._weekly - - @weekly.setter - def weekly(self, weekly): - """Sets the weekly of this ScoreViewsCounts. - - The weekly number of views of the score # noqa: E501 - - :param weekly: The weekly of this ScoreViewsCounts. # noqa: E501 - :type: float + A computed version of the total, weekly, monthly, and yearly number of views of the score + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total number of views of the score") + weekly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weekly number of views of the score") + monthly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The monthly number of views of the score") + yearly: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The yearly number of views of the score") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["total", "weekly", "monthly", "yearly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScoreViewsCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScoreViewsCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "weekly": obj.get("weekly"), + "monthly": obj.get("monthly"), + "yearly": obj.get("yearly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._weekly = weekly - - @property - def monthly(self): - """Gets the monthly of this ScoreViewsCounts. # noqa: E501 - - The monthly number of views of the score # noqa: E501 - - :return: The monthly of this ScoreViewsCounts. # noqa: E501 - :rtype: float - """ - return self._monthly - - @monthly.setter - def monthly(self, monthly): - """Sets the monthly of this ScoreViewsCounts. - - The monthly number of views of the score # noqa: E501 - - :param monthly: The monthly of this ScoreViewsCounts. # noqa: E501 - :type: float - """ - self._monthly = monthly - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ScoreViewsCounts): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/task.py b/flat_api/models/task.py new file mode 100644 index 0000000..8483ce3 --- /dev/null +++ b/flat_api/models/task.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.task_progress import TaskProgress +from flat_api.models.task_result import TaskResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Task(BaseModel): + """ + An asynchronous task + """ # noqa: E501 + id: StrictStr = Field(description="Unique identifier of the task") + type: Optional[StrictStr] = Field(default=None, description="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 ") + state: StrictStr = Field(description="State of the Task") + format: Optional[StrictStr] = Field(default=None, description="For files processing, the file format (e.g. `mp3`, `wav`)") + score: Optional[StrictStr] = Field(default=None, description="The score unique identifier for tasks related to scores") + revision: Optional[StrictStr] = Field(default=None, description="The score revision identifier for tasks related to scores") + progress: Optional[TaskProgress] = None + creation_date: Optional[datetime] = Field(default=None, description="The creation date of the task", alias="creationDate") + modification_date: Optional[datetime] = Field(default=None, description="The last modification date of the task", alias="modificationDate") + done_date: Optional[datetime] = Field(default=None, description="The date when the task has been completed", alias="doneDate") + result: Optional[TaskResult] = None + error_history: Optional[List[StrictStr]] = Field(default=None, description="If any errors happened when processing this task, the list of errors identifiers", alias="errorHistory") + is_cancellable: Optional[StrictBool] = Field(default=None, description="Whether the task can be canceled by the user. Only `true` when the task is in `created` state (waiting to be processed). ", alias="isCancellable") + children: Optional[List[Task]] = Field(default=None, description="Child tasks for hierarchical task structures (e.g., conversion subtasks)") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "state", "format", "score", "revision", "progress", "creationDate", "modificationDate", "doneDate", "result", "errorHistory", "isCancellable", "children"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['created', 'blocked', 'doing', 'done', 'canceled', 'error']): + raise ValueError("must be one of enum values ('created', 'blocked', 'doing', 'done', 'canceled', 'error')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Task from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "is_cancellable", + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of progress + if self.progress: + _dict['progress'] = self.progress.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in children (list) + _items = [] + if self.children: + for _item_children in self.children: + if _item_children: + _items.append(_item_children.to_dict()) + _dict['children'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Task from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "state": obj.get("state"), + "format": obj.get("format"), + "score": obj.get("score"), + "revision": obj.get("revision"), + "progress": TaskProgress.from_dict(obj["progress"]) if obj.get("progress") is not None else None, + "creationDate": obj.get("creationDate"), + "modificationDate": obj.get("modificationDate"), + "doneDate": obj.get("doneDate"), + "result": TaskResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "errorHistory": obj.get("errorHistory"), + "isCancellable": obj.get("isCancellable"), + "children": [Task.from_dict(_item) for _item in obj["children"]] if obj.get("children") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +# TODO: Rewrite to not use raise_errors +Task.model_rebuild(raise_errors=False) + diff --git a/flat_api/models/task_export_options.py b/flat_api/models/task_export_options.py new file mode 100644 index 0000000..b86c008 --- /dev/null +++ b/flat_api/models/task_export_options.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskExportOptions(BaseModel): + """ + Options for the requested export + """ # noqa: E501 + parts: Optional[List[StrictStr]] = Field(default=None, description="A list of parts to specifically export") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["parts"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskExportOptions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskExportOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parts": obj.get("parts") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/task_progress.py b/flat_api/models/task_progress.py new file mode 100644 index 0000000..f626978 --- /dev/null +++ b/flat_api/models/task_progress.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskProgress(BaseModel): + """ + Details about the task progression + """ # noqa: E501 + percent: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Percent of the task progression") + text: Optional[StrictStr] = Field(default=None, description="Text details of the task progress") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["percent", "text"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskProgress from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskProgress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "percent": obj.get("percent"), + "text": obj.get("text") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/task_result.py b/flat_api/models/task_result.py new file mode 100644 index 0000000..829e286 --- /dev/null +++ b/flat_api/models/task_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaskResult(BaseModel): + """ + Optional result information about this task + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL of the generated file, when the task produces one") + error: Optional[StrictStr] = Field(default=None, description="Error message, when the task failed") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["url", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaskResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaskResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/teaching_theme.py b/flat_api/models/teaching_theme.py new file mode 100644 index 0000000..a5d5204 --- /dev/null +++ b/flat_api/models/teaching_theme.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TeachingTheme(str, Enum): + """ + Teaching theme + """ + + """ + allowed enum values + """ + COMPOSITION = 'composition' + MUSIC_MINUS_THEORY = 'music-theory' + GENERAL_MINUS_MUSIC = 'general-music' + BAND = 'band' + CHOIR = 'choir' + ORCHESTRA = 'orchestra' + JAZZ_MINUS_ENSEMBLE = 'jazz-ensemble' + MUSIC_MINUS_TECHNOLOGY = 'music-technology' + OTHER = 'other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TeachingTheme from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/tutteo_product.py b/flat_api/models/tutteo_product.py new file mode 100644 index 0000000..fc70afb --- /dev/null +++ b/flat_api/models/tutteo_product.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TutteoProduct(str, Enum): + """ + A Tutteo product. * `flat`: [Flat](https://flat.io) - Music notation software for individual users * `flatEdu`: [Flat for Education](https://flat.io/edu) - Music notation software for schools and educators * `msnippet`: [Music Snippet](https://musicsnippet.com) - Embeddable music snippets for websites * `embed`: [Flat Embed](https://flat.io/developers/embed) - Embeddable music notation editor + """ + + """ + allowed enum values + """ + FLAT = 'flat' + FLATEDU = 'flatEdu' + MSNIPPET = 'msnippet' + EMBED = 'embed' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TutteoProduct from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flat_api/models/user_admin_update.py b/flat_api/models/user_admin_update.py index 3e650f9..e3ee04a 100644 --- a/flat_api/models/user_admin_update.py +++ b/flat_api/models/user_admin_update.py @@ -3,142 +3,112 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from flat_api.models.organization_roles import OrganizationRoles +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python - -class UserAdminUpdate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +class UserAdminUpdate(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'password': 'str', - 'organization_role': 'OrganizationRoles' - } - - attribute_map = { - 'password': 'password', - 'organization_role': 'organizationRole' - } - - def __init__(self, password=None, organization_role=None): # noqa: E501 - """UserAdminUpdate - a model defined in Swagger""" # noqa: E501 - - self._password = None - self._organization_role = None - self.discriminator = None - - if password is not None: - self.password = password - if organization_role is not None: - self.organization_role = organization_role - - @property - def password(self): - """Gets the password of this UserAdminUpdate. # noqa: E501 - - Password of the new account # noqa: E501 - - :return: The password of this UserAdminUpdate. # noqa: E501 - :rtype: str - """ - return self._password - - @password.setter - def password(self, password): - """Sets the password of this UserAdminUpdate. - - Password of the new account # noqa: E501 - - :param password: The password of this UserAdminUpdate. # noqa: E501 - :type: str - """ - if password is not None and len(password) < 6: - raise ValueError("Invalid value for `password`, length must be greater than or equal to `6`") # noqa: E501 - - self._password = password - - @property - def organization_role(self): - """Gets the organization_role of this UserAdminUpdate. # noqa: E501 - - - :return: The organization_role of this UserAdminUpdate. # noqa: E501 - :rtype: OrganizationRoles + User update as an organization admin + """ # noqa: E501 + password: Optional[Annotated[str, Field(min_length=6, strict=True, max_length=1000)]] = Field(default=None, description="Password of the account") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + username: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=30)]] = Field(default=None, description="Username of the account") + firstname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="First name of the user") + lastname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="Last name of the user") + email: Optional[StrictStr] = Field(default=None, description="Email of the account") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["password", "organizationRole", "username", "firstname", "lastname", "email"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAdminUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._organization_role + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAdminUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "password": obj.get("password"), + "organizationRole": obj.get("organizationRole"), + "username": obj.get("username"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "email": obj.get("email") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @organization_role.setter - def organization_role(self, organization_role): - """Sets the organization_role of this UserAdminUpdate. - - - :param organization_role: The organization_role of this UserAdminUpdate. # noqa: E501 - :type: OrganizationRoles - """ - self._organization_role = organization_role - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserAdminUpdate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_azure_details.py b/flat_api/models/user_azure_details.py new file mode 100644 index 0000000..8a3439f --- /dev/null +++ b/flat_api/models/user_azure_details.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserAzureDetails(BaseModel): + """ + UserAzureDetails + """ # noqa: E501 + oid: Optional[StrictStr] = Field(default=None, description="User object identifier on Azure AD") + hd: Optional[StrictStr] = Field(default=None, description="User tenant (domain name)") + preferred_username: Optional[StrictStr] = Field(default=None, description="User Preferred Username (UPN), i.e. the main email of the user", alias="preferredUsername") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["oid", "hd", "preferredUsername"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAzureDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAzureDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "oid": obj.get("oid"), + "hd": obj.get("hd"), + "preferredUsername": obj.get("preferredUsername") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/user_basics.py b/flat_api/models/user_basics.py index ba390fc..8589ba2 100644 --- a/flat_api/models/user_basics.py +++ b/flat_api/models/user_basics.py @@ -3,264 +3,131 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - - -class UserBasics(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.tutteo_product import TutteoProduct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +class UserBasics(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'username': 'str', - 'name': 'str', - 'printable_name': 'str', - 'picture': 'str', - 'is_power_user': 'bool' - } - - attribute_map = { - 'id': 'id', - 'username': 'username', - 'name': 'name', - 'printable_name': 'printableName', - 'picture': 'picture', - 'is_power_user': 'isPowerUser' - } - - discriminator_value_class_map = { - 'UserDetails': 'UserDetails', - 'UserPublic': 'UserPublic', - 'UserPublicSummary': 'UserPublicSummary', - 'UserDetailsAdmin': 'UserDetailsAdmin' - } - - def __init__(self, id=None, username=None, name=None, printable_name=None, picture=None, is_power_user=None): # noqa: E501 - """UserBasics - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._username = None - self._name = None - self._printable_name = None - self._picture = None - self._is_power_user = None - self.discriminator = 'userType' - - if id is not None: - self.id = id - if username is not None: - self.username = username - if name is not None: - self.name = name - if printable_name is not None: - self.printable_name = printable_name - if picture is not None: - self.picture = picture - if is_power_user is not None: - self.is_power_user = is_power_user - - @property - def id(self): - """Gets the id of this UserBasics. # noqa: E501 - - The user unique identifier # noqa: E501 - - :return: The id of this UserBasics. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this UserBasics. - - The user unique identifier # noqa: E501 - - :param id: The id of this UserBasics. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def username(self): - """Gets the username of this UserBasics. # noqa: E501 - - The user name (unique for the organization) # noqa: E501 - - :return: The username of this UserBasics. # noqa: E501 - :rtype: str - """ - return self._username - - @username.setter - def username(self, username): - """Sets the username of this UserBasics. - - The user name (unique for the organization) # noqa: E501 - - :param username: The username of this UserBasics. # noqa: E501 - :type: str - """ - - self._username = username - - @property - def name(self): - """Gets the name of this UserBasics. # noqa: E501 - - A displayable name for the user # noqa: E501 - - :return: The name of this UserBasics. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this UserBasics. - - A displayable name for the user # noqa: E501 - - :param name: The name of this UserBasics. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def printable_name(self): - """Gets the printable_name of this UserBasics. # noqa: E501 - - The name that can be directly printed (name or username) # noqa: E501 - - :return: The printable_name of this UserBasics. # noqa: E501 - :rtype: str + UserBasics + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: Optional[StrictStr] = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserBasics from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._printable_name - - @printable_name.setter - def printable_name(self, printable_name): - """Sets the printable_name of this UserBasics. - - The name that can be directly printed (name or username) # noqa: E501 - - :param printable_name: The printable_name of this UserBasics. # noqa: E501 - :type: str - """ - - self._printable_name = printable_name - - @property - def picture(self): - """Gets the picture of this UserBasics. # noqa: E501 - - User pictue # noqa: E501 - - :return: The picture of this UserBasics. # noqa: E501 - :rtype: str - """ - return self._picture - - @picture.setter - def picture(self, picture): - """Sets the picture of this UserBasics. - - User pictue # noqa: E501 - - :param picture: The picture of this UserBasics. # noqa: E501 - :type: str - """ - - self._picture = picture - - @property - def is_power_user(self): - """Gets the is_power_user of this UserBasics. # noqa: E501 - - User license status. 'True' if user is an individual Power user # noqa: E501 - - :return: The is_power_user of this UserBasics. # noqa: E501 - :rtype: bool - """ - return self._is_power_user - - @is_power_user.setter - def is_power_user(self, is_power_user): - """Sets the is_power_user of this UserBasics. - - User license status. 'True' if user is an individual Power user # noqa: E501 - - :param is_power_user: The is_power_user of this UserBasics. # noqa: E501 - :type: bool - """ - - self._is_power_user = is_power_user - - def get_real_child_model(self, data): - """Returns the real base class specified by the discriminator""" - discriminator_value = data[self.discriminator].lower() - return self.discriminator_value_class_map.get(discriminator_value) - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserBasics): - return False + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if picture (nullable) is None + # and model_fields_set contains the field + if self.picture is None and "picture" in self.model_fields_set: + _dict['picture'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserBasics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_community_profile_links.py b/flat_api/models/user_community_profile_links.py new file mode 100644 index 0000000..8a76d12 --- /dev/null +++ b/flat_api/models/user_community_profile_links.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserCommunityProfileLinks(BaseModel): + """ + Social networks links + """ # noqa: E501 + spotify_url: Optional[StrictStr] = Field(default=None, description="Spotify Profile URL", alias="spotifyUrl") + youtube_url: Optional[StrictStr] = Field(default=None, description="YouTube channel URL", alias="youtubeUrl") + soundcloud_url: Optional[StrictStr] = Field(default=None, description="SoundCloud Profile URL", alias="soundcloudUrl") + tiktok_url: Optional[StrictStr] = Field(default=None, description="TikTok profile URL. For updates, also accepts TikTok usernames", alias="tiktokUrl") + instagram_url: Optional[StrictStr] = Field(default=None, description="Instagram profile URL. For updates, also accepts Instagram usernames", alias="instagramUrl") + website_url: Optional[StrictStr] = Field(default=None, description="Personal website URL", alias="websiteUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["spotifyUrl", "youtubeUrl", "soundcloudUrl", "tiktokUrl", "instagramUrl", "websiteUrl"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserCommunityProfileLinks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if spotify_url (nullable) is None + # and model_fields_set contains the field + if self.spotify_url is None and "spotify_url" in self.model_fields_set: + _dict['spotifyUrl'] = None + + # set to None if youtube_url (nullable) is None + # and model_fields_set contains the field + if self.youtube_url is None and "youtube_url" in self.model_fields_set: + _dict['youtubeUrl'] = None + + # set to None if soundcloud_url (nullable) is None + # and model_fields_set contains the field + if self.soundcloud_url is None and "soundcloud_url" in self.model_fields_set: + _dict['soundcloudUrl'] = None + + # set to None if tiktok_url (nullable) is None + # and model_fields_set contains the field + if self.tiktok_url is None and "tiktok_url" in self.model_fields_set: + _dict['tiktokUrl'] = None + + # set to None if instagram_url (nullable) is None + # and model_fields_set contains the field + if self.instagram_url is None and "instagram_url" in self.model_fields_set: + _dict['instagramUrl'] = None + + # set to None if website_url (nullable) is None + # and model_fields_set contains the field + if self.website_url is None and "website_url" in self.model_fields_set: + _dict['websiteUrl'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserCommunityProfileLinks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "spotifyUrl": obj.get("spotifyUrl"), + "youtubeUrl": obj.get("youtubeUrl"), + "soundcloudUrl": obj.get("soundcloudUrl"), + "tiktokUrl": obj.get("tiktokUrl"), + "instagramUrl": obj.get("instagramUrl"), + "websiteUrl": obj.get("websiteUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/user_creation.py b/flat_api/models/user_creation.py index 5105c4f..f254101 100644 --- a/flat_api/models/user_creation.py +++ b/flat_api/models/user_creation.py @@ -3,202 +3,123 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 +import json -import six - -from flat_api.models.flat_locales import FlatLocales # noqa: F401,E501 - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python -class UserCreation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +class UserCreation(BaseModel): """ - swagger_types = { - 'username': 'str', - 'email': 'str', - 'password': 'str', - 'locale': 'FlatLocales' - } - - attribute_map = { - 'username': 'username', - 'email': 'email', - 'password': 'password', - 'locale': 'locale' - } - - def __init__(self, username=None, email=None, password=None, locale=None): # noqa: E501 - """UserCreation - a model defined in Swagger""" # noqa: E501 - - self._username = None - self._email = None - self._password = None - self._locale = None - self.discriminator = None - - self.username = username - if email is not None: - self.email = email - self.password = password - if locale is not None: - self.locale = locale - - @property - def username(self): - """Gets the username of this UserCreation. # noqa: E501 - - Username of the new account # noqa: E501 - - :return: The username of this UserCreation. # noqa: E501 - :rtype: str - """ - return self._username - - @username.setter - def username(self, username): - """Sets the username of this UserCreation. - - Username of the new account # noqa: E501 - - :param username: The username of this UserCreation. # noqa: E501 - :type: str - """ - if username is None: - raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 - if username is not None and not re.search('^[A-Za-z0-9\\-_.]+$', username): # noqa: E501 - raise ValueError("Invalid value for `username`, must be a follow pattern or equal to `/^[A-Za-z0-9\\-_.]+$/`") # noqa: E501 - - self._username = username - - @property - def email(self): - """Gets the email of this UserCreation. # noqa: E501 - - Email of the new account # noqa: E501 - - :return: The email of this UserCreation. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this UserCreation. - - Email of the new account # noqa: E501 - - :param email: The email of this UserCreation. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def password(self): - """Gets the password of this UserCreation. # noqa: E501 - - Password of the new account # noqa: E501 - - :return: The password of this UserCreation. # noqa: E501 - :rtype: str - """ - return self._password - - @password.setter - def password(self, password): - """Sets the password of this UserCreation. - - Password of the new account # noqa: E501 - - :param password: The password of this UserCreation. # noqa: E501 - :type: str - """ - if password is None: - raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 - if password is not None and len(password) < 6: - raise ValueError("Invalid value for `password`, length must be greater than or equal to `6`") # noqa: E501 - - self._password = password - - @property - def locale(self): - """Gets the locale of this UserCreation. # noqa: E501 - - - :return: The locale of this UserCreation. # noqa: E501 - :rtype: FlatLocales + User creation + """ # noqa: E501 + username: Annotated[str, Field(min_length=1, strict=True, max_length=30)] = Field(description="Username of the new account") + firstname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="First name of the user") + lastname: Optional[Annotated[str, Field(strict=True, max_length=60)]] = Field(default=None, description="Last name of the user") + email: Optional[StrictStr] = Field(default=None, description="Email of the new account") + password: Annotated[str, Field(min_length=6, strict=True, max_length=1000)] = Field(description="Password of the new account") + locale: Optional[StrictStr] = Field(default='en', description="User language. Input values will be automatically normalized to a supported locale code.") + role: Optional[StrictStr] = Field(default='user', description="Role of the new account") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["username", "firstname", "lastname", "email", "password", "locale", "role"] + + @field_validator('role') + def role_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['user', 'teacher', 'admin', 'accountAdmin']): + raise ValueError("must be one of enum values ('user', 'teacher', 'admin', 'accountAdmin')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._locale - - @locale.setter - def locale(self, locale): - """Sets the locale of this UserCreation. + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "email": obj.get("email"), + "password": obj.get("password"), + "locale": obj.get("locale") if obj.get("locale") is not None else 'en', + "role": obj.get("role") if obj.get("role") is not None else 'user' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - :param locale: The locale of this UserCreation. # noqa: E501 - :type: FlatLocales - """ - - self._locale = locale - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserCreation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_details.py b/flat_api/models/user_details.py index acb3a90..1feb315 100644 --- a/flat_api/models/user_details.py +++ b/flat_api/models/user_details.py @@ -3,206 +3,193 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_roles import ClassRoles # noqa: F401,E501 -from flat_api.models.flat_locales import FlatLocales # noqa: F401,E501 -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 -from flat_api.models.user_instruments import UserInstruments # noqa: F401,E501 -from flat_api.models.user_public import UserPublic # noqa: F401,E501 - - -class UserDetails(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.class_roles import ClassRoles +from flat_api.models.organization_roles import OrganizationRoles +from flat_api.models.tutteo_product import TutteoProduct +from flat_api.models.user_azure_details import UserAzureDetails +from flat_api.models.user_community_profile_links import UserCommunityProfileLinks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetails(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'type': 'str', - 'private_profile': 'bool', - 'locale': 'FlatLocales' - } - - attribute_map = { - 'id': 'id', - 'type': 'type', - 'private_profile': 'privateProfile', - 'locale': 'locale' - } - - def __init__(self, id=None, type=None, private_profile=None, locale=None): # noqa: E501 - """UserDetails - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._type = None - self._private_profile = None - self._locale = None - self.discriminator = None - - if id is not None: - self.id = id - if type is not None: - self.type = type - if private_profile is not None: - self.private_profile = private_profile - if locale is not None: - self.locale = locale - - @property - def id(self): - """Gets the id of this UserDetails. # noqa: E501 - - Identifier of the user # noqa: E501 - - :return: The id of this UserDetails. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this UserDetails. - - Identifier of the user # noqa: E501 - - :param id: The id of this UserDetails. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def type(self): - """Gets the type of this UserDetails. # noqa: E501 - - The type of account # noqa: E501 - - :return: The type of this UserDetails. # noqa: E501 - :rtype: str + User details + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + bio: Optional[StrictStr] = Field(default=None, description="User's biography") + registration_date: Optional[datetime] = Field(default=None, description="Date the user signed up", alias="registrationDate") + liked_scores_count: Optional[StrictInt] = Field(default=None, description="Number of the scores liked by the user", alias="likedScoresCount") + followers_count: Optional[StrictInt] = Field(default=None, description="Number of followers the user has", alias="followersCount") + following_count: Optional[StrictInt] = Field(default=None, description="Number of people the user follows", alias="followingCount") + owned_public_scores_count: Optional[StrictInt] = Field(default=None, description="Number of public scores the user owns", alias="ownedPublicScoresCount") + all_public_scores_count: Optional[StrictInt] = Field(default=None, description="Total number of public scores the user participates in (owned + joined)", alias="allPublicScoresCount") + likes_count: Optional[StrictInt] = Field(default=None, description="Number of likes on the user published scores", alias="likesCount") + plays_count: Optional[StrictInt] = Field(default=None, description="Number of plays on the user published scores", alias="playsCount") + cover_picture: Optional[StrictStr] = Field(default=None, description="Cover picture (background) for the profile", alias="coverPicture") + profile_theme: Optional[StrictStr] = Field(default=None, description="Theme (background) for the profile", alias="profileTheme") + links: Optional[UserCommunityProfileLinks] = None + is_email_verified: Optional[StrictBool] = Field(default=None, description="Whether the user's email address has been verified", alias="isEmailVerified") + azure_details: Optional[UserAzureDetails] = Field(default=None, alias="azureDetails") + private_profile: Optional[StrictBool] = Field(default=None, description="Whether this user profile is private (individual accounts only)", alias="privateProfile") + locale: Optional[StrictStr] = Field(default='en', description="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` ") + groups: Optional[List[StrictStr]] = Field(default=None, description="For Flat for Education accounts, list of Group identifiers the user is part of.") + picture_file: Optional[StrictStr] = Field(default=None, description="The ID of the user profile picture", alias="pictureFile") + cover_picture_file: Optional[StrictStr] = Field(default=None, description="The ID of the user profile cover picture", alias="coverPictureFile") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "bio", "registrationDate", "likedScoresCount", "followersCount", "followingCount", "ownedPublicScoresCount", "allPublicScoresCount", "likesCount", "playsCount", "coverPicture", "profileTheme", "links", "isEmailVerified", "azureDetails", "privateProfile", "locale", "groups", "pictureFile", "coverPictureFile"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._type + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of azure_details + if self.azure_details: + _dict['azureDetails'] = self.azure_details.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if picture_file (nullable) is None + # and model_fields_set contains the field + if self.picture_file is None and "picture_file" in self.model_fields_set: + _dict['pictureFile'] = None + + # set to None if cover_picture_file (nullable) is None + # and model_fields_set contains the field + if self.cover_picture_file is None and "cover_picture_file" in self.model_fields_set: + _dict['coverPictureFile'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "bio": obj.get("bio"), + "registrationDate": obj.get("registrationDate"), + "likedScoresCount": obj.get("likedScoresCount"), + "followersCount": obj.get("followersCount"), + "followingCount": obj.get("followingCount"), + "ownedPublicScoresCount": obj.get("ownedPublicScoresCount"), + "allPublicScoresCount": obj.get("allPublicScoresCount"), + "likesCount": obj.get("likesCount"), + "playsCount": obj.get("playsCount"), + "coverPicture": obj.get("coverPicture"), + "profileTheme": obj.get("profileTheme"), + "links": UserCommunityProfileLinks.from_dict(obj["links"]) if obj.get("links") is not None else None, + "isEmailVerified": obj.get("isEmailVerified"), + "azureDetails": UserAzureDetails.from_dict(obj["azureDetails"]) if obj.get("azureDetails") is not None else None, + "privateProfile": obj.get("privateProfile"), + "locale": obj.get("locale") if obj.get("locale") is not None else 'en', + "groups": obj.get("groups"), + "pictureFile": obj.get("pictureFile"), + "coverPictureFile": obj.get("coverPictureFile") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @type.setter - def type(self, type): - """Sets the type of this UserDetails. - - The type of account # noqa: E501 - - :param type: The type of this UserDetails. # noqa: E501 - :type: str - """ - allowed_values = ["user", "guest"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) - ) - - self._type = type - - @property - def private_profile(self): - """Gets the private_profile of this UserDetails. # noqa: E501 - - Tell either this user profile is private or not (individual accounts only) # noqa: E501 - - :return: The private_profile of this UserDetails. # noqa: E501 - :rtype: bool - """ - return self._private_profile - - @private_profile.setter - def private_profile(self, private_profile): - """Sets the private_profile of this UserDetails. - - Tell either this user profile is private or not (individual accounts only) # noqa: E501 - - :param private_profile: The private_profile of this UserDetails. # noqa: E501 - :type: bool - """ - - self._private_profile = private_profile - - @property - def locale(self): - """Gets the locale of this UserDetails. # noqa: E501 - - - :return: The locale of this UserDetails. # noqa: E501 - :rtype: FlatLocales - """ - return self._locale - - @locale.setter - def locale(self, locale): - """Sets the locale of this UserDetails. - - - :param locale: The locale of this UserDetails. # noqa: E501 - :type: FlatLocales - """ - self._locale = locale - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserDetails): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_details_admin.py b/flat_api/models/user_details_admin.py index 39c8e6c..e34dcec 100644 --- a/flat_api/models/user_details_admin.py +++ b/flat_api/models/user_details_admin.py @@ -3,171 +3,151 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_roles import ClassRoles # noqa: F401,E501 -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 -from flat_api.models.user_details_admin_license import UserDetailsAdminLicense # noqa: F401,E501 -from flat_api.models.user_public_summary import UserPublicSummary # noqa: F401,E501 - - -class UserDetailsAdmin(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.class_roles import ClassRoles +from flat_api.models.organization_roles import OrganizationRoles +from flat_api.models.tutteo_product import TutteoProduct +from flat_api.models.user_details_admin_all_of_license import UserDetailsAdminAllOfLicense +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetailsAdmin(BaseModel): """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'email': 'str', - 'last_activity_date': 'datetime', - 'license': 'UserDetailsAdminLicense' - } - - attribute_map = { - 'email': 'email', - 'last_activity_date': 'lastActivityDate', - 'license': 'license' - } - - def __init__(self, email=None, last_activity_date=None, license=None): # noqa: E501 - """UserDetailsAdmin - a model defined in Swagger""" # noqa: E501 - - self._email = None - self._last_activity_date = None - self._license = None - self.discriminator = None - - if email is not None: - self.email = email - if last_activity_date is not None: - self.last_activity_date = last_activity_date - if license is not None: - self.license = license - - @property - def email(self): - """Gets the email of this UserDetailsAdmin. # noqa: E501 - - Email of the user # noqa: E501 - - :return: The email of this UserDetailsAdmin. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this UserDetailsAdmin. - - Email of the user # noqa: E501 - - :param email: The email of this UserDetailsAdmin. # noqa: E501 - :type: str + User details (view for organization teacher / admin) + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + email: Optional[StrictStr] = Field(default=None, description="Email of the user") + last_activity_date: Optional[datetime] = Field(default=None, description="Date of the last user activity", alias="lastActivityDate") + license: Optional[UserDetailsAdminAllOfLicense] = None + groups: Optional[List[StrictStr]] = Field(default=None, description="For Flat for Education accounts, list of Group identifiers the user is part of.") + is_edu_testing_student: Optional[StrictBool] = Field(default=None, description="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. ", alias="isEduTestingStudent") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "email", "lastActivityDate", "license", "groups", "isEduTestingStudent"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetailsAdmin from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of license + if self.license: + _dict['license'] = self.license.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetailsAdmin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "email": obj.get("email"), + "lastActivityDate": obj.get("lastActivityDate"), + "license": UserDetailsAdminAllOfLicense.from_dict(obj["license"]) if obj.get("license") is not None else None, + "groups": obj.get("groups"), + "isEduTestingStudent": obj.get("isEduTestingStudent") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - self._email = email - - @property - def last_activity_date(self): - """Gets the last_activity_date of this UserDetailsAdmin. # noqa: E501 - - Date of the last user activity # noqa: E501 - - :return: The last_activity_date of this UserDetailsAdmin. # noqa: E501 - :rtype: datetime - """ - return self._last_activity_date - - @last_activity_date.setter - def last_activity_date(self, last_activity_date): - """Sets the last_activity_date of this UserDetailsAdmin. - - Date of the last user activity # noqa: E501 - - :param last_activity_date: The last_activity_date of this UserDetailsAdmin. # noqa: E501 - :type: datetime - """ - - self._last_activity_date = last_activity_date - - @property - def license(self): - """Gets the license of this UserDetailsAdmin. # noqa: E501 - - - :return: The license of this UserDetailsAdmin. # noqa: E501 - :rtype: UserDetailsAdminLicense - """ - return self._license - - @license.setter - def license(self, license): - """Sets the license of this UserDetailsAdmin. - - - :param license: The license of this UserDetailsAdmin. # noqa: E501 - :type: UserDetailsAdminLicense - """ - self._license = license - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserDetailsAdmin): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_details_admin_all_of_license.py b/flat_api/models/user_details_admin_all_of_license.py new file mode 100644 index 0000000..bd0d3c8 --- /dev/null +++ b/flat_api/models/user_details_admin_all_of_license.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.license_mode import LicenseMode +from flat_api.models.license_sources import LicenseSources +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserDetailsAdminAllOfLicense(BaseModel): + """ + Current active license of the user + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="ID of the current license") + expiration_date: Optional[datetime] = Field(default=None, description="Date when the license expires", alias="expirationDate") + source: Optional[LicenseSources] = LicenseSources.ORDER + mode: Optional[LicenseMode] = None + active: Optional[StrictBool] = Field(default=None, description="Whether the license is currently active") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "expirationDate", "source", "mode", "active"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetailsAdminAllOfLicense from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetailsAdminAllOfLicense from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "expirationDate": obj.get("expirationDate"), + "source": obj.get("source") if obj.get("source") is not None else LicenseSources.ORDER, + "mode": obj.get("mode"), + "active": obj.get("active") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/user_details_admin_license.py b/flat_api/models/user_details_admin_license.py deleted file mode 100644 index 3b844f9..0000000 --- a/flat_api/models/user_details_admin_license.py +++ /dev/null @@ -1,225 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - -from flat_api.models.license_mode import LicenseMode # noqa: F401,E501 -from flat_api.models.license_sources import LicenseSources # noqa: F401,E501 - - -class UserDetailsAdminLicense(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'expiration_date': 'datetime', - 'source': 'LicenseSources', - 'mode': 'LicenseMode', - 'active': 'bool' - } - - attribute_map = { - 'id': 'id', - 'expiration_date': 'expirationDate', - 'source': 'source', - 'mode': 'mode', - 'active': 'active' - } - - def __init__(self, id=None, expiration_date=None, source=None, mode=None, active=None): # noqa: E501 - """UserDetailsAdminLicense - a model defined in Swagger""" # noqa: E501 - - self._id = None - self._expiration_date = None - self._source = None - self._mode = None - self._active = None - self.discriminator = None - - if id is not None: - self.id = id - if expiration_date is not None: - self.expiration_date = expiration_date - if source is not None: - self.source = source - if mode is not None: - self.mode = mode - if active is not None: - self.active = active - - @property - def id(self): - """Gets the id of this UserDetailsAdminLicense. # noqa: E501 - - ID of the current license # noqa: E501 - - :return: The id of this UserDetailsAdminLicense. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this UserDetailsAdminLicense. - - ID of the current license # noqa: E501 - - :param id: The id of this UserDetailsAdminLicense. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def expiration_date(self): - """Gets the expiration_date of this UserDetailsAdminLicense. # noqa: E501 - - Date when the license expires # noqa: E501 - - :return: The expiration_date of this UserDetailsAdminLicense. # noqa: E501 - :rtype: datetime - """ - return self._expiration_date - - @expiration_date.setter - def expiration_date(self, expiration_date): - """Sets the expiration_date of this UserDetailsAdminLicense. - - Date when the license expires # noqa: E501 - - :param expiration_date: The expiration_date of this UserDetailsAdminLicense. # noqa: E501 - :type: datetime - """ - - self._expiration_date = expiration_date - - @property - def source(self): - """Gets the source of this UserDetailsAdminLicense. # noqa: E501 - - - :return: The source of this UserDetailsAdminLicense. # noqa: E501 - :rtype: LicenseSources - """ - return self._source - - @source.setter - def source(self, source): - """Sets the source of this UserDetailsAdminLicense. - - - :param source: The source of this UserDetailsAdminLicense. # noqa: E501 - :type: LicenseSources - """ - - self._source = source - - @property - def mode(self): - """Gets the mode of this UserDetailsAdminLicense. # noqa: E501 - - - :return: The mode of this UserDetailsAdminLicense. # noqa: E501 - :rtype: LicenseMode - """ - return self._mode - - @mode.setter - def mode(self, mode): - """Sets the mode of this UserDetailsAdminLicense. - - - :param mode: The mode of this UserDetailsAdminLicense. # noqa: E501 - :type: LicenseMode - """ - - self._mode = mode - - @property - def active(self): - """Gets the active of this UserDetailsAdminLicense. # noqa: E501 - - ID of the current license # noqa: E501 - - :return: The active of this UserDetailsAdminLicense. # noqa: E501 - :rtype: bool - """ - return self._active - - @active.setter - def active(self, active): - """Sets the active of this UserDetailsAdminLicense. - - ID of the current license # noqa: E501 - - :param active: The active of this UserDetailsAdminLicense. # noqa: E501 - :type: bool - """ - - self._active = active - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserDetailsAdminLicense): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_instruments.py b/flat_api/models/user_instruments.py deleted file mode 100644 index 605af6d..0000000 --- a/flat_api/models/user_instruments.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import pprint -import re # noqa: F401 - -import six - - -class UserInstruments(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """UserInstruments - a model defined in Swagger""" # noqa: E501 - self.discriminator = None - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserInstruments): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_public.py b/flat_api/models/user_public.py index 77c4916..dfe1317 100644 --- a/flat_api/models/user_public.py +++ b/flat_api/models/user_public.py @@ -3,311 +3,170 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_roles import ClassRoles # noqa: F401,E501 -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 -from flat_api.models.user_instruments import UserInstruments # noqa: F401,E501 -from flat_api.models.user_public_summary import UserPublicSummary # noqa: F401,E501 - - -class UserPublic(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.class_roles import ClassRoles +from flat_api.models.organization_roles import OrganizationRoles +from flat_api.models.tutteo_product import TutteoProduct +from flat_api.models.user_community_profile_links import UserCommunityProfileLinks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserPublic(BaseModel): """ - swagger_types = { - 'bio': 'str', - 'registration_date': 'datetime', - 'liked_scores_count': 'int', - 'followers_count': 'int', - 'following_count': 'int', - 'owned_public_scores_count': 'int', - 'profile_theme': 'str', - 'instruments': 'UserInstruments' - } - - attribute_map = { - 'bio': 'bio', - 'registration_date': 'registrationDate', - 'liked_scores_count': 'likedScoresCount', - 'followers_count': 'followersCount', - 'following_count': 'followingCount', - 'owned_public_scores_count': 'ownedPublicScoresCount', - 'profile_theme': 'profileTheme', - 'instruments': 'instruments' - } - - def __init__(self, bio=None, registration_date=None, liked_scores_count=None, followers_count=None, following_count=None, owned_public_scores_count=None, profile_theme=None, instruments=None): # noqa: E501 - """UserPublic - a model defined in Swagger""" # noqa: E501 - - self._bio = None - self._registration_date = None - self._liked_scores_count = None - self._followers_count = None - self._following_count = None - self._owned_public_scores_count = None - self._profile_theme = None - self._instruments = None - self.discriminator = None - - if bio is not None: - self.bio = bio - if registration_date is not None: - self.registration_date = registration_date - if liked_scores_count is not None: - self.liked_scores_count = liked_scores_count - if followers_count is not None: - self.followers_count = followers_count - if following_count is not None: - self.following_count = following_count - if owned_public_scores_count is not None: - self.owned_public_scores_count = owned_public_scores_count - if profile_theme is not None: - self.profile_theme = profile_theme - if instruments is not None: - self.instruments = instruments - - @property - def bio(self): - """Gets the bio of this UserPublic. # noqa: E501 - - User's biography # noqa: E501 - - :return: The bio of this UserPublic. # noqa: E501 - :rtype: str - """ - return self._bio - - @bio.setter - def bio(self, bio): - """Sets the bio of this UserPublic. - - User's biography # noqa: E501 - - :param bio: The bio of this UserPublic. # noqa: E501 - :type: str - """ - - self._bio = bio - - @property - def registration_date(self): - """Gets the registration_date of this UserPublic. # noqa: E501 - - Date the user signed up # noqa: E501 - - :return: The registration_date of this UserPublic. # noqa: E501 - :rtype: datetime - """ - return self._registration_date - - @registration_date.setter - def registration_date(self, registration_date): - """Sets the registration_date of this UserPublic. - - Date the user signed up # noqa: E501 - - :param registration_date: The registration_date of this UserPublic. # noqa: E501 - :type: datetime - """ - - self._registration_date = registration_date - - @property - def liked_scores_count(self): - """Gets the liked_scores_count of this UserPublic. # noqa: E501 - - Number of the scores liked by the user # noqa: E501 - - :return: The liked_scores_count of this UserPublic. # noqa: E501 - :rtype: int - """ - return self._liked_scores_count - - @liked_scores_count.setter - def liked_scores_count(self, liked_scores_count): - """Sets the liked_scores_count of this UserPublic. - - Number of the scores liked by the user # noqa: E501 - - :param liked_scores_count: The liked_scores_count of this UserPublic. # noqa: E501 - :type: int - """ - - self._liked_scores_count = liked_scores_count - - @property - def followers_count(self): - """Gets the followers_count of this UserPublic. # noqa: E501 - - Number of followers the user have # noqa: E501 - - :return: The followers_count of this UserPublic. # noqa: E501 - :rtype: int - """ - return self._followers_count - - @followers_count.setter - def followers_count(self, followers_count): - """Sets the followers_count of this UserPublic. - - Number of followers the user have # noqa: E501 - - :param followers_count: The followers_count of this UserPublic. # noqa: E501 - :type: int - """ - - self._followers_count = followers_count - - @property - def following_count(self): - """Gets the following_count of this UserPublic. # noqa: E501 - - Number of people the user follow # noqa: E501 - - :return: The following_count of this UserPublic. # noqa: E501 - :rtype: int - """ - return self._following_count - - @following_count.setter - def following_count(self, following_count): - """Sets the following_count of this UserPublic. - - Number of people the user follow # noqa: E501 - - :param following_count: The following_count of this UserPublic. # noqa: E501 - :type: int - """ - - self._following_count = following_count - - @property - def owned_public_scores_count(self): - """Gets the owned_public_scores_count of this UserPublic. # noqa: E501 - - Number of public scores the user have # noqa: E501 - - :return: The owned_public_scores_count of this UserPublic. # noqa: E501 - :rtype: int - """ - return self._owned_public_scores_count - - @owned_public_scores_count.setter - def owned_public_scores_count(self, owned_public_scores_count): - """Sets the owned_public_scores_count of this UserPublic. - - Number of public scores the user have # noqa: E501 - - :param owned_public_scores_count: The owned_public_scores_count of this UserPublic. # noqa: E501 - :type: int - """ - - self._owned_public_scores_count = owned_public_scores_count - - @property - def profile_theme(self): - """Gets the profile_theme of this UserPublic. # noqa: E501 - - Theme (background) for the profile # noqa: E501 - - :return: The profile_theme of this UserPublic. # noqa: E501 - :rtype: str - """ - return self._profile_theme - - @profile_theme.setter - def profile_theme(self, profile_theme): - """Sets the profile_theme of this UserPublic. - - Theme (background) for the profile # noqa: E501 - - :param profile_theme: The profile_theme of this UserPublic. # noqa: E501 - :type: str - """ - - self._profile_theme = profile_theme - - @property - def instruments(self): - """Gets the instruments of this UserPublic. # noqa: E501 - - - :return: The instruments of this UserPublic. # noqa: E501 - :rtype: UserInstruments - """ - return self._instruments - - @instruments.setter - def instruments(self, instruments): - """Sets the instruments of this UserPublic. - - - :param instruments: The instruments of this UserPublic. # noqa: E501 - :type: UserInstruments - """ - - self._instruments = instruments - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserPublic): - return False + Public User details + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + bio: Optional[StrictStr] = Field(default=None, description="User's biography") + registration_date: Optional[datetime] = Field(default=None, description="Date the user signed up", alias="registrationDate") + liked_scores_count: Optional[StrictInt] = Field(default=None, description="Number of the scores liked by the user", alias="likedScoresCount") + followers_count: Optional[StrictInt] = Field(default=None, description="Number of followers the user has", alias="followersCount") + following_count: Optional[StrictInt] = Field(default=None, description="Number of people the user follows", alias="followingCount") + owned_public_scores_count: Optional[StrictInt] = Field(default=None, description="Number of public scores the user owns", alias="ownedPublicScoresCount") + all_public_scores_count: Optional[StrictInt] = Field(default=None, description="Total number of public scores the user participates in (owned + joined)", alias="allPublicScoresCount") + likes_count: Optional[StrictInt] = Field(default=None, description="Number of likes on the user published scores", alias="likesCount") + plays_count: Optional[StrictInt] = Field(default=None, description="Number of plays on the user published scores", alias="playsCount") + cover_picture: Optional[StrictStr] = Field(default=None, description="Cover picture (background) for the profile", alias="coverPicture") + profile_theme: Optional[StrictStr] = Field(default=None, description="Theme (background) for the profile", alias="profileTheme") + links: Optional[UserCommunityProfileLinks] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl", "bio", "registrationDate", "likedScoresCount", "followersCount", "followingCount", "ownedPublicScoresCount", "allPublicScoresCount", "likesCount", "playsCount", "coverPicture", "profileTheme", "links"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserPublic from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['links'] = self.links.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if cover_picture (nullable) is None + # and model_fields_set contains the field + if self.cover_picture is None and "cover_picture" in self.model_fields_set: + _dict['coverPicture'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserPublic from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl"), + "bio": obj.get("bio"), + "registrationDate": obj.get("registrationDate"), + "likedScoresCount": obj.get("likedScoresCount"), + "followersCount": obj.get("followersCount"), + "followingCount": obj.get("followingCount"), + "ownedPublicScoresCount": obj.get("ownedPublicScoresCount"), + "allPublicScoresCount": obj.get("allPublicScoresCount"), + "likesCount": obj.get("likesCount"), + "playsCount": obj.get("playsCount"), + "coverPicture": obj.get("coverPicture"), + "profileTheme": obj.get("profileTheme"), + "links": UserCommunityProfileLinks.from_dict(obj["links"]) if obj.get("links") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - return self.__dict__ == other.__dict__ - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_public_summary.py b/flat_api/models/user_public_summary.py index 4eb8430..c70fd4f 100644 --- a/flat_api/models/user_public_summary.py +++ b/flat_api/models/user_public_summary.py @@ -3,196 +3,136 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations import pprint import re # noqa: F401 - -import six - -from flat_api.models.class_roles import ClassRoles # noqa: F401,E501 -from flat_api.models.organization_roles import OrganizationRoles # noqa: F401,E501 -from flat_api.models.user_basics import UserBasics # noqa: F401,E501 - - -class UserPublicSummary(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from flat_api.models.class_roles import ClassRoles +from flat_api.models.organization_roles import OrganizationRoles +from flat_api.models.tutteo_product import TutteoProduct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserPublicSummary(BaseModel): """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'organization': 'str', - 'organization_role': 'OrganizationRoles', - 'class_role': 'ClassRoles', - 'html_url': 'str' - } - - attribute_map = { - 'organization': 'organization', - 'organization_role': 'organizationRole', - 'class_role': 'classRole', - 'html_url': 'htmlUrl' - } - - def __init__(self, organization=None, organization_role=None, class_role=None, html_url=None): # noqa: E501 - """UserPublicSummary - a model defined in Swagger""" # noqa: E501 - - self._organization = None - self._organization_role = None - self._class_role = None - self._html_url = None - self.discriminator = None - - if organization is not None: - self.organization = organization - if organization_role is not None: - self.organization_role = organization_role - if class_role is not None: - self.class_role = class_role - if html_url is not None: - self.html_url = html_url - - @property - def organization(self): - """Gets the organization of this UserPublicSummary. # noqa: E501 - - Organization ID (for Edu users only) # noqa: E501 - - :return: The organization of this UserPublicSummary. # noqa: E501 - :rtype: str - """ - return self._organization - - @organization.setter - def organization(self, organization): - """Sets the organization of this UserPublicSummary. - - Organization ID (for Edu users only) # noqa: E501 - - :param organization: The organization of this UserPublicSummary. # noqa: E501 - :type: str - """ - - self._organization = organization - - @property - def organization_role(self): - """Gets the organization_role of this UserPublicSummary. # noqa: E501 - - - :return: The organization_role of this UserPublicSummary. # noqa: E501 - :rtype: OrganizationRoles + Public User details summary + """ # noqa: E501 + id: StrictStr = Field(description="The user unique identifier") + type: StrictStr = Field(description="The type of user account") + product: TutteoProduct + username: StrictStr = Field(description="The user name (unique for the organization)") + printable_name: Optional[StrictStr] = Field(default=None, description="The name that can be directly printed (name, firstname & lastname, or username)", alias="printableName") + firstname: Optional[StrictStr] = Field(default=None, description="Firstname of the user (for education users)") + lastname: Optional[StrictStr] = Field(default=None, description="Lastname of the user (for education users)") + name: Optional[StrictStr] = Field(default=None, description="A displayable name for the user (for consumer users)") + picture: StrictStr = Field(description="The URL of the picture to display") + badges: Optional[List[StrictStr]] = Field(default=None, description="List of badges for the user profile: - `power` - `staff` - `composerOfTheMonth` - `ambassador` - `challenge` ") + organization: Optional[StrictStr] = Field(default=None, description="Organization ID (for Edu users only)") + organization_role: Optional[OrganizationRoles] = Field(default=None, alias="organizationRole") + class_role: Optional[ClassRoles] = Field(default=None, alias="classRole") + html_url: Optional[StrictStr] = Field(default=None, description="Link to user profile (for Indiv. users only)", alias="htmlUrl") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "product", "username", "printableName", "firstname", "lastname", "name", "picture", "badges", "organization", "organizationRole", "classRole", "htmlUrl"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['user', 'guest']): + raise ValueError("must be one of enum values ('user', 'guest')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserPublicSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ - return self._organization_role + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserPublicSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "product": obj.get("product") if obj.get("product") is not None else TutteoProduct.FLAT, + "username": obj.get("username"), + "printableName": obj.get("printableName"), + "firstname": obj.get("firstname"), + "lastname": obj.get("lastname"), + "name": obj.get("name"), + "picture": obj.get("picture"), + "badges": obj.get("badges"), + "organization": obj.get("organization"), + "organizationRole": obj.get("organizationRole"), + "classRole": obj.get("classRole"), + "htmlUrl": obj.get("htmlUrl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - @organization_role.setter - def organization_role(self, organization_role): - """Sets the organization_role of this UserPublicSummary. - - - :param organization_role: The organization_role of this UserPublicSummary. # noqa: E501 - :type: OrganizationRoles - """ - - self._organization_role = organization_role - - @property - def class_role(self): - """Gets the class_role of this UserPublicSummary. # noqa: E501 - - - :return: The class_role of this UserPublicSummary. # noqa: E501 - :rtype: ClassRoles - """ - return self._class_role - - @class_role.setter - def class_role(self, class_role): - """Sets the class_role of this UserPublicSummary. - - - :param class_role: The class_role of this UserPublicSummary. # noqa: E501 - :type: ClassRoles - """ - - self._class_role = class_role - - @property - def html_url(self): - """Gets the html_url of this UserPublicSummary. # noqa: E501 - - Link to user profile (for Indiv. users only) # noqa: E501 - - :return: The html_url of this UserPublicSummary. # noqa: E501 - :rtype: str - """ - return self._html_url - - @html_url.setter - def html_url(self, html_url): - """Sets the html_url of this UserPublicSummary. - - Link to user profile (for Indiv. users only) # noqa: E501 - - :param html_url: The html_url of this UserPublicSummary. # noqa: E501 - :type: str - """ - self._html_url = html_url - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, UserPublicSummary): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/flat_api/models/user_signin_link.py b/flat_api/models/user_signin_link.py new file mode 100644 index 0000000..193f529 --- /dev/null +++ b/flat_api/models/user_signin_link.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserSigninLink(BaseModel): + """ + UserSigninLink + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL to use to sign in to this account") + token: Optional[StrictStr] = Field(default=None, description="Raw sign-in token, can be used to build custom URLs (e.g. deep links)") + expiration_date: Optional[datetime] = Field(default=None, description="Date when the link expires", alias="expirationDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["url", "token", "expirationDate"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSigninLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSigninLink from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "token": obj.get("token"), + "expirationDate": obj.get("expirationDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/models/user_signin_link_creation.py b/flat_api/models/user_signin_link_creation.py new file mode 100644 index 0000000..da7461b --- /dev/null +++ b/flat_api/models/user_signin_link_creation.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Flat API + + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) + + The version of the OpenAPI document: 2.26.2 + Contact: developers@flat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UserSigninLinkCreation(BaseModel): + """ + UserSigninLinkCreation + """ # noqa: E501 + destination_path: Optional[StrictStr] = Field(default='/', description="Path to redirect to after signin", alias="destinationPath") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destinationPath"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSigninLinkCreation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSigninLinkCreation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destinationPath": obj.get("destinationPath") if obj.get("destinationPath") is not None else '/' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/flat_api/oauth.py b/flat_api/oauth.py new file mode 100644 index 0000000..66d1935 --- /dev/null +++ b/flat_api/oauth.py @@ -0,0 +1,145 @@ +"""OAuth2 support for the Flat API. + +The public specification declares one security scheme: OAuth2 with the authorization-code flow and +23 scopes. A Personal Access Token is an OAuth access token for your own account, so passing a token +straight to the client covers both cases. + +A refresh token is only issued when the authorization request sets ``access_type=offline``. + +This module never stores a token. Persistence is deployment-specific, so the client hands refreshed +tokens to a callback you supply and it is your job to save them. +""" + +from __future__ import annotations + +import threading +import time +from dataclasses import dataclass, field +from urllib.parse import urlencode + +import httpx + +from flat_api.errors import FlatAuthenticationError + +__all__ = ["Tokens", "OAuth2Helper", "TokenManager"] + +AUTHORIZE_URL = "https://flat.io/auth/oauth" +TOKEN_URL = "https://api.flat.io/oauth/access_token" + +#: Refresh this many seconds before nominal expiry, to avoid racing the server clock. +EXPIRY_SKEW = 30.0 + + +@dataclass +class Tokens: + access_token: str + refresh_token: str | None = None + expires_at: float | None = None + + @classmethod + def from_response(cls, payload: dict) -> "Tokens": + expires_in = payload.get("expires_in") + return cls( + access_token=payload["access_token"], + refresh_token=payload.get("refresh_token"), + expires_at=time.time() + float(expires_in) if expires_in else None, + ) + + @property + def expired(self) -> bool: + return self.expires_at is not None and time.time() >= self.expires_at - EXPIRY_SKEW + + +class OAuth2Helper: + """Builds the authorization URL and exchanges codes for tokens.""" + + def __init__(self, client_id: str, client_secret: str, redirect_uri: str) -> None: + self.client_id = client_id + self.client_secret = client_secret + self.redirect_uri = redirect_uri + + def authorize_url( + self, + scopes: list[str], + state: str, + *, + offline: bool = True, + ) -> str: + """URL to send a user to. ``offline=True`` is what yields a refresh token.""" + params = { + "client_id": self.client_id, + "redirect_uri": self.redirect_uri, + "response_type": "code", + "scope": " ".join(scopes), + "state": state, + } + if offline: + params["access_type"] = "offline" + return f"{AUTHORIZE_URL}?{urlencode(params)}" + + def exchange_code(self, code: str) -> Tokens: + return self._token_request( + {"grant_type": "authorization_code", "code": code, "redirect_uri": self.redirect_uri} + ) + + def refresh(self, refresh_token: str) -> Tokens: + return self._token_request( + {"grant_type": "refresh_token", "refresh_token": refresh_token} + ) + + def _token_request(self, payload: dict) -> Tokens: + body = {**payload, "client_id": self.client_id, "client_secret": self.client_secret} + response = httpx.post(TOKEN_URL, data=body, timeout=30) + if response.status_code >= 400: + raise FlatAuthenticationError( + "OAuth2 token request failed; the user must re-authorize", + status=response.status_code, + body=_safe_json(response), + ) + return Tokens.from_response(response.json()) + + +class TokenManager: + """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. + """ + + def __init__( + self, + tokens: Tokens, + helper: OAuth2Helper | None = None, + on_token_refresh=None, + ) -> None: + self._tokens = tokens + self._helper = helper + self._on_refresh = on_token_refresh + self._lock = threading.Lock() + + @property + def access_token(self) -> str: + return self._tokens.access_token + + def refresh(self) -> str: + """Refresh once, even under concurrency, and return the new access token.""" + with self._lock: + current = self._tokens.access_token + if self._tokens.access_token != current: + return self._tokens.access_token + if self._helper is None or not self._tokens.refresh_token: + raise FlatAuthenticationError( + "the access token expired and no refresh token is available; " + "the user must re-authorize" + ) + self._tokens = self._helper.refresh(self._tokens.refresh_token) + if self._on_refresh is not None: + self._on_refresh(self._tokens) + return self._tokens.access_token + + +def _safe_json(response: httpx.Response): + try: + return response.json() + except ValueError: + return None diff --git a/flat_api/pagination.py b/flat_api/pagination.py new file mode 100644 index 0000000..3d4990c --- /dev/null +++ b/flat_api/pagination.py @@ -0,0 +1,73 @@ +"""Cursor pagination for the Flat API. + +Eight operations at v2.25.0 are cursor-paginated, identified by a ``next`` query parameter. Note the +parameter is a shared component (``#/components/parameters/next``): any tool that reads an +operation\'s parameters without resolving ``$ref`` under-counts them and ships collections that +silently truncate. + +The cursor itself is **not in the response body**. It arrives in the ``Link`` header, which the +specification does not declare, so it is parsed at runtime from the generated ``ApiResponse``. +""" + +from __future__ import annotations + +import re +from collections.abc import Callable, Iterator +from typing import Any, TypeVar + +__all__ = ["parse_link_header", "paginate"] + +T = TypeVar("T") + +_LINK = re.compile(r'<(?P[^>]+)>\s*;\s*rel="(?P[^"]+)"') +_NEXT_PARAM = re.compile(r"[?&]next=(?P[^&]+)") + + +def parse_link_header(value: str | None) -> dict[str, str]: + """Parse an RFC 5988 Link header into {rel: url}.""" + if not value: + return {} + return {m.group("rel"): m.group("url") for m in _LINK.finditer(value)} + + +def next_cursor(headers: dict[str, str] | None) -> str | None: + """Extract the opaque ``next`` cursor from a response\'s Link header, if any.""" + if not headers: + return None + link = next((v for k, v in headers.items() if k.lower() == "link"), None) + url = parse_link_header(link).get("next") + if not url: + return None + match = _NEXT_PARAM.search(url) + return match.group("cursor") if match else None + + +def paginate( + fetch_page: Callable[..., Any], + *args: Any, + **kwargs: Any, +) -> Iterator[T]: + """Yield every item across all pages of a cursor-paginated operation. + + ``fetch_page`` must be the generated ``*_with_http_info`` variant, which returns an + ``ApiResponse`` carrying the headers the cursor lives in. + + 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. + """ + cursor: str | None = kwargs.pop("next", None) + seen: set[str] = set() + + while True: + response = fetch_page(*args, **({**kwargs, "next": cursor} if cursor else kwargs)) + page = getattr(response, "data", response) + if page: + yield from page + + cursor = next_cursor(getattr(response, "headers", None)) + if not cursor: + return + # A server that returns a cursor it already gave us would loop forever. + if cursor in seen: + return + seen.add(cursor) diff --git a/test/__init__.py b/flat_api/py.typed similarity index 100% rename from test/__init__.py rename to flat_api/py.typed diff --git a/flat_api/rest.py b/flat_api/rest.py index 61e162c..36abefa 100644 --- a/flat_api/rest.py +++ b/flat_api/rest.py @@ -3,60 +3,112 @@ """ Flat API - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 + 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, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * 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. The Flat API is built on HTTP. Our API is RESTful: it has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference are [available on GitHub](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) - OpenAPI spec version: 2.6.0 + The version of the OpenAPI document: 2.26.2 Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import +import ipaddress import io import json -import logging import re import ssl +from urllib.parse import urlparse + +import urllib3 + +from flat_api.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +def should_bypass_proxies(url: str, no_proxy: str) -> bool: + """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" + parsed_url = urlparse(url) + if not parsed_url.hostname: + return True -import certifi -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import urlencode + host = parsed_url.hostname.lower() + host_and_port = parsed_url.netloc.lower() + try: + host_ip = ipaddress.ip_address(host) + except ValueError: + host_ip = None -try: - import urllib3 -except ImportError: - raise ImportError('Swagger python client requires urllib3.') + for entry in (entry.strip().lower() for entry in no_proxy.split(',')): + if not entry: + continue + if entry == '*': + return True + if host_ip is not None: + try: + if host_ip in ipaddress.ip_network(entry, strict=False): + return True + except ValueError: + pass -logger = logging.getLogger(__name__) + entry = entry.lstrip('.') + if ( + host == entry + or host.endswith('.' + entry) + or host_and_port == entry + or host_and_port.endswith('.' + entry) + ): + return True + + return False class RESTResponse(io.IOBase): - def __init__(self, resp): - self.urllib3_response = resp + def __init__(self, resp) -> None: + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = resp.data + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.urllib3_response.getheaders() + """Returns a dictionary of the response headers; use ``headers`` instead.""" + return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" - return self.urllib3_response.getheader(name, default) + """Returns a given response header; use ``headers.get()`` instead.""" + return self.response.headers.get(name, default) -class RESTClientObject(object): +class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None): + def __init__(self, configuration) -> None: # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs @@ -65,73 +117,85 @@ def __init__(self, configuration, pools_size=4, maxsize=None): else: cert_reqs = ssl.CERT_NONE - # ca_certs - if configuration.ssl_ca_cert: - ca_certs = configuration.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager - if configuration.proxy: - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - **addition_pool_args - ) + self.pool_manager: urllib3.PoolManager + + if configuration.proxy and not should_bypass_proxies( + configuration.host, configuration.no_proxy or '' + ): + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): """Perform requests. :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] if post_params and body: - raise ValueError( + raise ApiValueError( "body parameter cannot be used with post_params parameter." ) @@ -140,60 +204,91 @@ def request(self, method, url, query_params=None, headers=None, timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, float)): timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) - - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' + connect=_request_timeout[0], + read=_request_timeout[1] + ) try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - if query_params: - url += '?' + urlencode(query_params) - if re.search('json', headers['Content-Type'], re.IGNORECASE): + + content_type = headers.get('Content-Type') + is_json = ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ) + # JSON is valid YAML 1.2, so structured YAML bodies can use + # the existing JSON serializer: + # https://yaml.org/spec/1.2.2/#13-relation-to-json + is_structured_yaml = ( + content_type + and re.search('yaml', content_type, re.IGNORECASE) + and not isinstance(body, (str, bytes)) + ) + if is_json or is_structured_yaml: request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, - preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, - preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, - preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + preload_content=False + ) # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form - elif isinstance(body, str): - request_body = body + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): r = self.pool_manager.request( - method, url, + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, body=request_body, - preload_content=_preload_content, + preload_content=False, timeout=timeout, headers=headers) else: @@ -204,120 +299,16 @@ def request(self, method, url, query_params=None, headers=None, raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request(method, url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) + msg = "\n".join([type(e).__name__, str(e)]) raise ApiException(status=0, reason=msg) - if _preload_content: - r = RESTResponse(r) - - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - -class ApiException(Exception): - - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message + return RESTResponse(r) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..eeb1647 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,87 @@ +[project] +name = "flat-api" +description = "The official Python client for the Flat API" +authors = [{ name = "Flat", email = "developers@flat.io" }] +license = "Apache-2.0" +license-files = ["LICENSE"] +readme = "README.md" +keywords = ["flat", "flat.io", "music", "notation", "openapi", "sheet-music"] +requires-python = ">=3.11" + +# VERSION is the durable source of truth (rule 5): it sits outside the generated zone and +# tools/generate.sh writes it. Deriving the packaged version from it here is what keeps the tag, +# the file and the published artifact from ever disagreeing. +dynamic = ["version"] + +dependencies = [ + # Synchronous transport. + "urllib3 >=1.25.3, <3", + # Asynchronous transport, for AsyncFlatClient. flat_api.client imports it unconditionally, + # so it is a hard requirement rather than an extra. + "aiohttp >=3.9", + "aiohttp-retry >=2.8", + # flat_api.oauth, re-exported from the package root. + "httpx >=0.27", + "pydantic >=2", + "python-dateutil >=2.8.2", + "typing-extensions >=4.7.1", +] + +[project.urls] +Homepage = "https://flat.io/developers/docs/api/" +Repository = "https://github.com/FlatIO/api-client-python" +Changelog = "https://github.com/FlatIO/api-client-python/blob/master/CHANGELOG.md" + +[build-system] +requires = ["setuptools>=77"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = { file = "VERSION" } + +[tool.setuptools.packages.find] +include = ["flat_api*"] + +[tool.setuptools.package-data] +flat_api = ["py.typed"] + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "flat_api", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/requirements.txt b/requirements.txt index bafdc07..d14a6fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,9 @@ -certifi >= 14.05.14 -six >= 1.10 -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.15.1 +# Runtime dependencies, kept in step with the [project] dependencies in pyproject.toml. +# pyproject.toml is what PyPI installs from; this file is for a local checkout. +urllib3 >= 1.25.3, < 3 +aiohttp >= 3.9 +aiohttp-retry >= 2.8 +httpx >= 0.27 +pydantic >= 2 +python-dateutil >= 2.8.2 +typing-extensions >= 4.7.1 diff --git a/setup.py b/setup.py deleted file mode 100644 index d366947..0000000 --- a/setup.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - OpenAPI spec version: 2.0.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -import sys -from setuptools import setup, find_packages - -NAME = "flat_api" -VERSION = "0.6.0" -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools - -REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] - -try: - import pypandoc - LONG_DESCRIPTION = open('README.md').read() - LONG_DESCRIPTION = LONG_DESCRIPTION[:LONG_DESCRIPTION.index('## Documentation for API Endpoints')] - LONG_DESCRIPTION = pypandoc.convert_text(LONG_DESCRIPTION, 'rst', format='md') -except(IOError, ImportError): - LONG_DESCRIPTION = open('README.md').read() - -setup( - name=NAME, - version=VERSION, - description="Flat API Client", - author="The Flat Team (https://flat.io)", - author_email="developers@flat.io", - url="https://github.com/FlatIO/api-client-python", - keywords=["Flat API", "MusicXML", "Music Notation", "MIDI"], - long_description=LONG_DESCRIPTION, - install_requires=REQUIRES, - packages=find_packages(), - include_package_data=True, - license="Apache", - classifiers=[ - "Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Developers", - "Intended Audience :: Education", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: Apache Software License", - "Operating System :: MacOS", - "Operating System :: POSIX", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Topic :: Artistic Software", - "Topic :: Education", - "Topic :: Multimedia :: Sound/Audio" - ] -) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 2702246..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 diff --git a/test/test_account_api.py b/test/test_account_api.py deleted file mode 100644 index 0a2d422..0000000 --- a/test/test_account_api.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.account_api import AccountApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestAccountApi(unittest.TestCase): - """AccountApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.account_api.AccountApi() # noqa: E501 - - def tearDown(self): - pass - - def test_get_authenticated_user(self): - """Test case for get_authenticated_user - - Get current user profile # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_assignment.py b/test/test_assignment.py deleted file mode 100644 index 4e02f1c..0000000 --- a/test/test_assignment.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.assignment import Assignment # noqa: E501 -from flat_api.rest import ApiException - - -class TestAssignment(unittest.TestCase): - """Assignment unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testAssignment(self): - """Test Assignment""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.assignment.Assignment() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_assignment_copy.py b/test/test_assignment_copy.py deleted file mode 100644 index b098110..0000000 --- a/test/test_assignment_copy.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.assignment_copy import AssignmentCopy # noqa: E501 -from flat_api.rest import ApiException - - -class TestAssignmentCopy(unittest.TestCase): - """AssignmentCopy unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testAssignmentCopy(self): - """Test AssignmentCopy""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.assignment_copy.AssignmentCopy() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_assignment_creation.py b/test/test_assignment_creation.py deleted file mode 100644 index 175af28..0000000 --- a/test/test_assignment_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.assignment_creation import AssignmentCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestAssignmentCreation(unittest.TestCase): - """AssignmentCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testAssignmentCreation(self): - """Test AssignmentCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.assignment_creation.AssignmentCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_assignment_submission.py b/test/test_assignment_submission.py deleted file mode 100644 index e120a46..0000000 --- a/test/test_assignment_submission.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.assignment_submission import AssignmentSubmission # noqa: E501 -from flat_api.rest import ApiException - - -class TestAssignmentSubmission(unittest.TestCase): - """AssignmentSubmission unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testAssignmentSubmission(self): - """Test AssignmentSubmission""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.assignment_submission.AssignmentSubmission() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_assignment_submission_update.py b/test/test_assignment_submission_update.py deleted file mode 100644 index d36d03e..0000000 --- a/test/test_assignment_submission_update.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.assignment_submission_update import AssignmentSubmissionUpdate # noqa: E501 -from flat_api.rest import ApiException - - -class TestAssignmentSubmissionUpdate(unittest.TestCase): - """AssignmentSubmissionUpdate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testAssignmentSubmissionUpdate(self): - """Test AssignmentSubmissionUpdate""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.assignment_submission_update.AssignmentSubmissionUpdate() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_api.py b/test/test_class_api.py deleted file mode 100644 index 150975b..0000000 --- a/test/test_class_api.py +++ /dev/null @@ -1,167 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.class_api import ClassApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassApi(unittest.TestCase): - """ClassApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.class_api.ClassApi() # noqa: E501 - - def tearDown(self): - pass - - def test_activate_class(self): - """Test case for activate_class - - Activate the class # noqa: E501 - """ - pass - - def test_add_class_user(self): - """Test case for add_class_user - - Add a user to the class # noqa: E501 - """ - pass - - def test_archive_class(self): - """Test case for archive_class - - Archive the class # noqa: E501 - """ - pass - - def test_copy_assignment(self): - """Test case for copy_assignment - - Copy an assignment # noqa: E501 - """ - pass - - def test_create_assignment(self): - """Test case for create_assignment - - Assignment creation # noqa: E501 - """ - pass - - def test_create_class(self): - """Test case for create_class - - Create a new class # noqa: E501 - """ - pass - - def test_create_submission(self): - """Test case for create_submission - - Create or edit a submission # noqa: E501 - """ - pass - - def test_delete_class_user(self): - """Test case for delete_class_user - - Remove a user from the class # noqa: E501 - """ - pass - - def test_edit_submission(self): - """Test case for edit_submission - - Edit a submission # noqa: E501 - """ - pass - - def test_enroll_class(self): - """Test case for enroll_class - - Join a class # noqa: E501 - """ - pass - - def test_get_class(self): - """Test case for get_class - - Get the details of a single class # noqa: E501 - """ - pass - - def test_get_score_submissions(self): - """Test case for get_score_submissions - - List submissions related to the score # noqa: E501 - """ - pass - - def test_get_submission(self): - """Test case for get_submission - - Get a student submission # noqa: E501 - """ - pass - - def test_get_submissions(self): - """Test case for get_submissions - - List the students' submissions # noqa: E501 - """ - pass - - def test_list_assignments(self): - """Test case for list_assignments - - Assignments listing # noqa: E501 - """ - pass - - def test_list_class_student_submissions(self): - """Test case for list_class_student_submissions - - List the submissions for a student # noqa: E501 - """ - pass - - def test_list_classes(self): - """Test case for list_classes - - List the classes available for the current user # noqa: E501 - """ - pass - - def test_unarchive_class(self): - """Test case for unarchive_class - - Unarchive the class # noqa: E501 - """ - pass - - def test_update_class(self): - """Test case for update_class - - Update the class # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_attachment_creation.py b/test/test_class_attachment_creation.py deleted file mode 100644 index 0c03bff..0000000 --- a/test/test_class_attachment_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_attachment_creation import ClassAttachmentCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassAttachmentCreation(unittest.TestCase): - """ClassAttachmentCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassAttachmentCreation(self): - """Test ClassAttachmentCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_attachment_creation.ClassAttachmentCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_creation.py b/test/test_class_creation.py deleted file mode 100644 index 23bde30..0000000 --- a/test/test_class_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_creation import ClassCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassCreation(unittest.TestCase): - """ClassCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassCreation(self): - """Test ClassCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_creation.ClassCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details.py b/test/test_class_details.py deleted file mode 100644 index b3a16ce..0000000 --- a/test/test_class_details.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details import ClassDetails # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetails(unittest.TestCase): - """ClassDetails unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetails(self): - """Test ClassDetails""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details.ClassDetails() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details_canvas.py b/test/test_class_details_canvas.py deleted file mode 100644 index f971e12..0000000 --- a/test/test_class_details_canvas.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details_canvas import ClassDetailsCanvas # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetailsCanvas(unittest.TestCase): - """ClassDetailsCanvas unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetailsCanvas(self): - """Test ClassDetailsCanvas""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details_canvas.ClassDetailsCanvas() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details_clever.py b/test/test_class_details_clever.py deleted file mode 100644 index 415a37a..0000000 --- a/test/test_class_details_clever.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details_clever import ClassDetailsClever # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetailsClever(unittest.TestCase): - """ClassDetailsClever unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetailsClever(self): - """Test ClassDetailsClever""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details_clever.ClassDetailsClever() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details_google_classroom.py b/test/test_class_details_google_classroom.py deleted file mode 100644 index e148de8..0000000 --- a/test/test_class_details_google_classroom.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details_google_classroom import ClassDetailsGoogleClassroom # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetailsGoogleClassroom(unittest.TestCase): - """ClassDetailsGoogleClassroom unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetailsGoogleClassroom(self): - """Test ClassDetailsGoogleClassroom""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details_google_classroom.ClassDetailsGoogleClassroom() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details_google_drive.py b/test/test_class_details_google_drive.py deleted file mode 100644 index 3032dd6..0000000 --- a/test/test_class_details_google_drive.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details_google_drive import ClassDetailsGoogleDrive # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetailsGoogleDrive(unittest.TestCase): - """ClassDetailsGoogleDrive unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetailsGoogleDrive(self): - """Test ClassDetailsGoogleDrive""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details_google_drive.ClassDetailsGoogleDrive() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_details_lti.py b/test/test_class_details_lti.py deleted file mode 100644 index e1637bc..0000000 --- a/test/test_class_details_lti.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_details_lti import ClassDetailsLti # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassDetailsLti(unittest.TestCase): - """ClassDetailsLti unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassDetailsLti(self): - """Test ClassDetailsLti""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_details_lti.ClassDetailsLti() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_roles.py b/test/test_class_roles.py deleted file mode 100644 index 7d078dd..0000000 --- a/test/test_class_roles.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_roles import ClassRoles # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassRoles(unittest.TestCase): - """ClassRoles unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassRoles(self): - """Test ClassRoles""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_roles.ClassRoles() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_state.py b/test/test_class_state.py deleted file mode 100644 index 4a8b880..0000000 --- a/test/test_class_state.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_state import ClassState # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassState(unittest.TestCase): - """ClassState unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassState(self): - """Test ClassState""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_state.ClassState() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_class_update.py b/test/test_class_update.py deleted file mode 100644 index 0d08abf..0000000 --- a/test/test_class_update.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.class_update import ClassUpdate # noqa: E501 -from flat_api.rest import ApiException - - -class TestClassUpdate(unittest.TestCase): - """ClassUpdate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testClassUpdate(self): - """Test ClassUpdate""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.class_update.ClassUpdate() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection.py b/test/test_collection.py deleted file mode 100644 index 3d99a00..0000000 --- a/test/test_collection.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection import Collection # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollection(unittest.TestCase): - """Collection unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollection(self): - """Test Collection""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection.Collection() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_api.py b/test/test_collection_api.py deleted file mode 100644 index 8b558c4..0000000 --- a/test/test_collection_api.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.collection_api import CollectionApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionApi(unittest.TestCase): - """CollectionApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.collection_api.CollectionApi() # noqa: E501 - - def tearDown(self): - pass - - def test_add_score_to_collection(self): - """Test case for add_score_to_collection - - Add a score to the collection # noqa: E501 - """ - pass - - def test_create_collection(self): - """Test case for create_collection - - Create a new collection # noqa: E501 - """ - pass - - def test_delete_collection(self): - """Test case for delete_collection - - Delete the collection # noqa: E501 - """ - pass - - def test_delete_score_from_collection(self): - """Test case for delete_score_from_collection - - Delete a score from the collection # noqa: E501 - """ - pass - - def test_edit_collection(self): - """Test case for edit_collection - - Update a collection's metadata # noqa: E501 - """ - pass - - def test_get_collection(self): - """Test case for get_collection - - Get collection details # noqa: E501 - """ - pass - - def test_list_collection_scores(self): - """Test case for list_collection_scores - - List the scores contained in a collection # noqa: E501 - """ - pass - - def test_list_collections(self): - """Test case for list_collections - - List the collections # noqa: E501 - """ - pass - - def test_untrash_collection(self): - """Test case for untrash_collection - - Untrash a collection # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_capabilities.py b/test/test_collection_capabilities.py deleted file mode 100644 index 14391c2..0000000 --- a/test/test_collection_capabilities.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_capabilities import CollectionCapabilities # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionCapabilities(unittest.TestCase): - """CollectionCapabilities unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionCapabilities(self): - """Test CollectionCapabilities""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_capabilities.CollectionCapabilities() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_creation.py b/test/test_collection_creation.py deleted file mode 100644 index 03d0897..0000000 --- a/test/test_collection_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_creation import CollectionCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionCreation(unittest.TestCase): - """CollectionCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionCreation(self): - """Test CollectionCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_creation.CollectionCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_modification.py b/test/test_collection_modification.py deleted file mode 100644 index cf4795c..0000000 --- a/test/test_collection_modification.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_modification import CollectionModification # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionModification(unittest.TestCase): - """CollectionModification unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionModification(self): - """Test CollectionModification""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_modification.CollectionModification() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_privacy.py b/test/test_collection_privacy.py deleted file mode 100644 index aab1746..0000000 --- a/test/test_collection_privacy.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_privacy import CollectionPrivacy # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionPrivacy(unittest.TestCase): - """CollectionPrivacy unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionPrivacy(self): - """Test CollectionPrivacy""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_privacy.CollectionPrivacy() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_title.py b/test/test_collection_title.py deleted file mode 100644 index 18f86e2..0000000 --- a/test/test_collection_title.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_title import CollectionTitle # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionTitle(unittest.TestCase): - """CollectionTitle unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionTitle(self): - """Test CollectionTitle""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_title.CollectionTitle() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_collection_type.py b/test/test_collection_type.py deleted file mode 100644 index d153516..0000000 --- a/test/test_collection_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.collection_type import CollectionType # noqa: E501 -from flat_api.rest import ApiException - - -class TestCollectionType(unittest.TestCase): - """CollectionType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCollectionType(self): - """Test CollectionType""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.collection_type.CollectionType() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_flat_error_response.py b/test/test_flat_error_response.py deleted file mode 100644 index 6468e0b..0000000 --- a/test/test_flat_error_response.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.flat_error_response import FlatErrorResponse # noqa: E501 -from flat_api.rest import ApiException - - -class TestFlatErrorResponse(unittest.TestCase): - """FlatErrorResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testFlatErrorResponse(self): - """Test FlatErrorResponse""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.flat_error_response.FlatErrorResponse() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_flat_locales.py b/test/test_flat_locales.py deleted file mode 100644 index b963f97..0000000 --- a/test/test_flat_locales.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.flat_locales import FlatLocales # noqa: E501 -from flat_api.rest import ApiException - - -class TestFlatLocales(unittest.TestCase): - """FlatLocales unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testFlatLocales(self): - """Test FlatLocales""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.flat_locales.FlatLocales() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_google_classroom_coursework.py b/test/test_google_classroom_coursework.py deleted file mode 100644 index 09e7080..0000000 --- a/test/test_google_classroom_coursework.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.google_classroom_coursework import GoogleClassroomCoursework # noqa: E501 -from flat_api.rest import ApiException - - -class TestGoogleClassroomCoursework(unittest.TestCase): - """GoogleClassroomCoursework unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testGoogleClassroomCoursework(self): - """Test GoogleClassroomCoursework""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.google_classroom_coursework.GoogleClassroomCoursework() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_google_classroom_submission.py b/test/test_google_classroom_submission.py deleted file mode 100644 index 041d09e..0000000 --- a/test/test_google_classroom_submission.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.google_classroom_submission import GoogleClassroomSubmission # noqa: E501 -from flat_api.rest import ApiException - - -class TestGoogleClassroomSubmission(unittest.TestCase): - """GoogleClassroomSubmission unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testGoogleClassroomSubmission(self): - """Test GoogleClassroomSubmission""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.google_classroom_submission.GoogleClassroomSubmission() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_group.py b/test/test_group.py deleted file mode 100644 index 39d5639..0000000 --- a/test/test_group.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.group import Group # noqa: E501 -from flat_api.rest import ApiException - - -class TestGroup(unittest.TestCase): - """Group unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testGroup(self): - """Test Group""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.group.Group() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_group_api.py b/test/test_group_api.py deleted file mode 100644 index c8db84c..0000000 --- a/test/test_group_api.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.group_api import GroupApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestGroupApi(unittest.TestCase): - """GroupApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.group_api.GroupApi() # noqa: E501 - - def tearDown(self): - pass - - def test_get_group_details(self): - """Test case for get_group_details - - Get group information # noqa: E501 - """ - pass - - def test_get_group_scores(self): - """Test case for get_group_scores - - List group's scores # noqa: E501 - """ - pass - - def test_list_group_users(self): - """Test case for list_group_users - - List group's users # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_group_details.py b/test/test_group_details.py deleted file mode 100644 index e542cb5..0000000 --- a/test/test_group_details.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.group_details import GroupDetails # noqa: E501 -from flat_api.rest import ApiException - - -class TestGroupDetails(unittest.TestCase): - """GroupDetails unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testGroupDetails(self): - """Test GroupDetails""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.group_details.GroupDetails() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_group_type.py b/test/test_group_type.py deleted file mode 100644 index e3fd7a7..0000000 --- a/test/test_group_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.group_type import GroupType # noqa: E501 -from flat_api.rest import ApiException - - -class TestGroupType(unittest.TestCase): - """GroupType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testGroupType(self): - """Test GroupType""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.group_type.GroupType() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_license_mode.py b/test/test_license_mode.py deleted file mode 100644 index 03c82c0..0000000 --- a/test/test_license_mode.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.license_mode import LicenseMode # noqa: E501 -from flat_api.rest import ApiException - - -class TestLicenseMode(unittest.TestCase): - """LicenseMode unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLicenseMode(self): - """Test LicenseMode""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.license_mode.LicenseMode() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_license_sources.py b/test/test_license_sources.py deleted file mode 100644 index 46c4127..0000000 --- a/test/test_license_sources.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.license_sources import LicenseSources # noqa: E501 -from flat_api.rest import ApiException - - -class TestLicenseSources(unittest.TestCase): - """LicenseSources unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLicenseSources(self): - """Test LicenseSources""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.license_sources.LicenseSources() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_lms_name.py b/test/test_lms_name.py deleted file mode 100644 index 9166f4a..0000000 --- a/test/test_lms_name.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.lms_name import LmsName # noqa: E501 -from flat_api.rest import ApiException - - -class TestLmsName(unittest.TestCase): - """LmsName unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLmsName(self): - """Test LmsName""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.lms_name.LmsName() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_lti_credentials.py b/test/test_lti_credentials.py deleted file mode 100644 index 27845aa..0000000 --- a/test/test_lti_credentials.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.lti_credentials import LtiCredentials # noqa: E501 -from flat_api.rest import ApiException - - -class TestLtiCredentials(unittest.TestCase): - """LtiCredentials unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLtiCredentials(self): - """Test LtiCredentials""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.lti_credentials.LtiCredentials() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_lti_credentials_creation.py b/test/test_lti_credentials_creation.py deleted file mode 100644 index 5fd8a4b..0000000 --- a/test/test_lti_credentials_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.lti_credentials_creation import LtiCredentialsCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestLtiCredentialsCreation(unittest.TestCase): - """LtiCredentialsCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLtiCredentialsCreation(self): - """Test LtiCredentialsCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.lti_credentials_creation.LtiCredentialsCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_media_attachment.py b/test/test_media_attachment.py deleted file mode 100644 index d930dd4..0000000 --- a/test/test_media_attachment.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.media_attachment import MediaAttachment # noqa: E501 -from flat_api.rest import ApiException - - -class TestMediaAttachment(unittest.TestCase): - """MediaAttachment unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testMediaAttachment(self): - """Test MediaAttachment""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.media_attachment.MediaAttachment() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_media_score_sharing_mode.py b/test/test_media_score_sharing_mode.py deleted file mode 100644 index d5ca5a7..0000000 --- a/test/test_media_score_sharing_mode.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.media_score_sharing_mode import MediaScoreSharingMode # noqa: E501 -from flat_api.rest import ApiException - - -class TestMediaScoreSharingMode(unittest.TestCase): - """MediaScoreSharingMode unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testMediaScoreSharingMode(self): - """Test MediaScoreSharingMode""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.media_score_sharing_mode.MediaScoreSharingMode() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_organization_api.py b/test/test_organization_api.py deleted file mode 100644 index a542a1d..0000000 --- a/test/test_organization_api.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.organization_api import OrganizationApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestOrganizationApi(unittest.TestCase): - """OrganizationApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.organization_api.OrganizationApi() # noqa: E501 - - def tearDown(self): - pass - - def test_create_lti_credentials(self): - """Test case for create_lti_credentials - - Create a new couple of LTI 1.x credentials # noqa: E501 - """ - pass - - def test_create_organization_invitation(self): - """Test case for create_organization_invitation - - Create a new invitation to join the organization # noqa: E501 - """ - pass - - def test_create_organization_user(self): - """Test case for create_organization_user - - Create a new user account # noqa: E501 - """ - pass - - def test_list_lti_credentials(self): - """Test case for list_lti_credentials - - List LTI 1.x credentials # noqa: E501 - """ - pass - - def test_list_organization_invitations(self): - """Test case for list_organization_invitations - - List the organization invitations # noqa: E501 - """ - pass - - def test_list_organization_users(self): - """Test case for list_organization_users - - List the organization users # noqa: E501 - """ - pass - - def test_remove_organization_invitation(self): - """Test case for remove_organization_invitation - - Remove an organization invitation # noqa: E501 - """ - pass - - def test_remove_organization_user(self): - """Test case for remove_organization_user - - Remove an account from Flat # noqa: E501 - """ - pass - - def test_revoke_lti_credentials(self): - """Test case for revoke_lti_credentials - - Revoke LTI 1.x credentials # noqa: E501 - """ - pass - - def test_update_organization_user(self): - """Test case for update_organization_user - - Update account information # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_organization_invitation.py b/test/test_organization_invitation.py deleted file mode 100644 index 03ac78e..0000000 --- a/test/test_organization_invitation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.organization_invitation import OrganizationInvitation # noqa: E501 -from flat_api.rest import ApiException - - -class TestOrganizationInvitation(unittest.TestCase): - """OrganizationInvitation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOrganizationInvitation(self): - """Test OrganizationInvitation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.organization_invitation.OrganizationInvitation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_organization_invitation_creation.py b/test/test_organization_invitation_creation.py deleted file mode 100644 index 155bda2..0000000 --- a/test/test_organization_invitation_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.organization_invitation_creation import OrganizationInvitationCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestOrganizationInvitationCreation(unittest.TestCase): - """OrganizationInvitationCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOrganizationInvitationCreation(self): - """Test OrganizationInvitationCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.organization_invitation_creation.OrganizationInvitationCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_organization_roles.py b/test/test_organization_roles.py deleted file mode 100644 index aa3f03f..0000000 --- a/test/test_organization_roles.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.organization_roles import OrganizationRoles # noqa: E501 -from flat_api.rest import ApiException - - -class TestOrganizationRoles(unittest.TestCase): - """OrganizationRoles unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOrganizationRoles(self): - """Test OrganizationRoles""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.organization_roles.OrganizationRoles() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_resource_collaborator.py b/test/test_resource_collaborator.py deleted file mode 100644 index 21a21b8..0000000 --- a/test/test_resource_collaborator.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.resource_collaborator import ResourceCollaborator # noqa: E501 -from flat_api.rest import ApiException - - -class TestResourceCollaborator(unittest.TestCase): - """ResourceCollaborator unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testResourceCollaborator(self): - """Test ResourceCollaborator""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.resource_collaborator.ResourceCollaborator() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_resource_collaborator_creation.py b/test/test_resource_collaborator_creation.py deleted file mode 100644 index 9a576b4..0000000 --- a/test/test_resource_collaborator_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.resource_collaborator_creation import ResourceCollaboratorCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestResourceCollaboratorCreation(unittest.TestCase): - """ResourceCollaboratorCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testResourceCollaboratorCreation(self): - """Test ResourceCollaboratorCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.resource_collaborator_creation.ResourceCollaboratorCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_resource_rights.py b/test/test_resource_rights.py deleted file mode 100644 index c79b14d..0000000 --- a/test/test_resource_rights.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.resource_rights import ResourceRights # noqa: E501 -from flat_api.rest import ApiException - - -class TestResourceRights(unittest.TestCase): - """ResourceRights unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testResourceRights(self): - """Test ResourceRights""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.resource_rights.ResourceRights() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_resource_sharing_key.py b/test/test_resource_sharing_key.py deleted file mode 100644 index daff645..0000000 --- a/test/test_resource_sharing_key.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.resource_sharing_key import ResourceSharingKey # noqa: E501 -from flat_api.rest import ApiException - - -class TestResourceSharingKey(unittest.TestCase): - """ResourceSharingKey unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testResourceSharingKey(self): - """Test ResourceSharingKey""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.resource_sharing_key.ResourceSharingKey() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_api.py b/test/test_score_api.py deleted file mode 100644 index 4677306..0000000 --- a/test/test_score_api.py +++ /dev/null @@ -1,237 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.score_api import ScoreApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreApi(unittest.TestCase): - """ScoreApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.score_api.ScoreApi() # noqa: E501 - - def tearDown(self): - pass - - def test_add_score_collaborator(self): - """Test case for add_score_collaborator - - Add a new collaborator # noqa: E501 - """ - pass - - def test_add_score_track(self): - """Test case for add_score_track - - Add a new video or audio track to the score # noqa: E501 - """ - pass - - def test_create_score(self): - """Test case for create_score - - Create a new score # noqa: E501 - """ - pass - - def test_create_score_revision(self): - """Test case for create_score_revision - - Create a new revision # noqa: E501 - """ - pass - - def test_delete_score(self): - """Test case for delete_score - - Delete a score # noqa: E501 - """ - pass - - def test_delete_score_comment(self): - """Test case for delete_score_comment - - Delete a comment # noqa: E501 - """ - pass - - def test_delete_score_track(self): - """Test case for delete_score_track - - Remove an audio or video track linked to the score # noqa: E501 - """ - pass - - def test_edit_score(self): - """Test case for edit_score - - Edit a score's metadata # noqa: E501 - """ - pass - - def test_fork_score(self): - """Test case for fork_score - - Fork a score # noqa: E501 - """ - pass - - def test_ger_user_likes(self): - """Test case for ger_user_likes - - List liked scores # noqa: E501 - """ - pass - - def test_get_group_scores(self): - """Test case for get_group_scores - - List group's scores # noqa: E501 - """ - pass - - def test_get_score(self): - """Test case for get_score - - Get a score's metadata # noqa: E501 - """ - pass - - def test_get_score_collaborator(self): - """Test case for get_score_collaborator - - Get a collaborator # noqa: E501 - """ - pass - - def test_get_score_collaborators(self): - """Test case for get_score_collaborators - - List the collaborators # noqa: E501 - """ - pass - - def test_get_score_comments(self): - """Test case for get_score_comments - - List comments # noqa: E501 - """ - pass - - def test_get_score_revision(self): - """Test case for get_score_revision - - Get a score revision # noqa: E501 - """ - pass - - def test_get_score_revision_data(self): - """Test case for get_score_revision_data - - Get a score revision data # noqa: E501 - """ - pass - - def test_get_score_revisions(self): - """Test case for get_score_revisions - - List the revisions # noqa: E501 - """ - pass - - def test_get_score_submissions(self): - """Test case for get_score_submissions - - List submissions related to the score # noqa: E501 - """ - pass - - def test_get_score_track(self): - """Test case for get_score_track - - Retrieve the details of an audio or video track linked to a score # noqa: E501 - """ - pass - - def test_get_user_scores(self): - """Test case for get_user_scores - - List user's scores # noqa: E501 - """ - pass - - def test_list_score_tracks(self): - """Test case for list_score_tracks - - List the audio or video tracks linked to a score # noqa: E501 - """ - pass - - def test_mark_score_comment_resolved(self): - """Test case for mark_score_comment_resolved - - Mark the comment as resolved # noqa: E501 - """ - pass - - def test_mark_score_comment_unresolved(self): - """Test case for mark_score_comment_unresolved - - Mark the comment as unresolved # noqa: E501 - """ - pass - - def test_post_score_comment(self): - """Test case for post_score_comment - - Post a new comment # noqa: E501 - """ - pass - - def test_remove_score_collaborator(self): - """Test case for remove_score_collaborator - - Delete a collaborator # noqa: E501 - """ - pass - - def test_untrash_score(self): - """Test case for untrash_score - - Untrash a score # noqa: E501 - """ - pass - - def test_update_score_comment(self): - """Test case for update_score_comment - - Update an existing comment # noqa: E501 - """ - pass - - def test_update_score_track(self): - """Test case for update_score_track - - Update an audio or video track linked to a score # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_comment.py b/test/test_score_comment.py deleted file mode 100644 index 5a4dd06..0000000 --- a/test/test_score_comment.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_comment import ScoreComment # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreComment(unittest.TestCase): - """ScoreComment unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreComment(self): - """Test ScoreComment""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_comment.ScoreComment() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_comment_context.py b/test/test_score_comment_context.py deleted file mode 100644 index d576b8f..0000000 --- a/test/test_score_comment_context.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_comment_context import ScoreCommentContext # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCommentContext(unittest.TestCase): - """ScoreCommentContext unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCommentContext(self): - """Test ScoreCommentContext""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_comment_context.ScoreCommentContext() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_comment_creation.py b/test/test_score_comment_creation.py deleted file mode 100644 index e7778d8..0000000 --- a/test/test_score_comment_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_comment_creation import ScoreCommentCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCommentCreation(unittest.TestCase): - """ScoreCommentCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCommentCreation(self): - """Test ScoreCommentCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_comment_creation.ScoreCommentCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_comment_update.py b/test/test_score_comment_update.py deleted file mode 100644 index dd590fb..0000000 --- a/test/test_score_comment_update.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_comment_update import ScoreCommentUpdate # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCommentUpdate(unittest.TestCase): - """ScoreCommentUpdate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCommentUpdate(self): - """Test ScoreCommentUpdate""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_comment_update.ScoreCommentUpdate() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_comments_counts.py b/test/test_score_comments_counts.py deleted file mode 100644 index 7df9a13..0000000 --- a/test/test_score_comments_counts.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_comments_counts import ScoreCommentsCounts # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCommentsCounts(unittest.TestCase): - """ScoreCommentsCounts unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCommentsCounts(self): - """Test ScoreCommentsCounts""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_comments_counts.ScoreCommentsCounts() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_creation.py b/test/test_score_creation.py deleted file mode 100644 index ac850d5..0000000 --- a/test/test_score_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_creation import ScoreCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCreation(unittest.TestCase): - """ScoreCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCreation(self): - """Test ScoreCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_creation.ScoreCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_creation_type.py b/test/test_score_creation_type.py deleted file mode 100644 index 6db933c..0000000 --- a/test/test_score_creation_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_creation_type import ScoreCreationType # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreCreationType(unittest.TestCase): - """ScoreCreationType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreCreationType(self): - """Test ScoreCreationType""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_creation_type.ScoreCreationType() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_data.py b/test/test_score_data.py deleted file mode 100644 index 2259872..0000000 --- a/test/test_score_data.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_data import ScoreData # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreData(unittest.TestCase): - """ScoreData unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreData(self): - """Test ScoreData""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_data.ScoreData() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_data_encoding.py b/test/test_score_data_encoding.py deleted file mode 100644 index f5a550d..0000000 --- a/test/test_score_data_encoding.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_data_encoding import ScoreDataEncoding # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreDataEncoding(unittest.TestCase): - """ScoreDataEncoding unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreDataEncoding(self): - """Test ScoreDataEncoding""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_data_encoding.ScoreDataEncoding() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_details.py b/test/test_score_details.py deleted file mode 100644 index 1cf2faf..0000000 --- a/test/test_score_details.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_details import ScoreDetails # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreDetails(unittest.TestCase): - """ScoreDetails unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreDetails(self): - """Test ScoreDetails""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_details.ScoreDetails() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_fork.py b/test/test_score_fork.py deleted file mode 100644 index 15b83c8..0000000 --- a/test/test_score_fork.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_fork import ScoreFork # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreFork(unittest.TestCase): - """ScoreFork unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreFork(self): - """Test ScoreFork""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_fork.ScoreFork() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_license.py b/test/test_score_license.py deleted file mode 100644 index 66fe61b..0000000 --- a/test/test_score_license.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_license import ScoreLicense # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreLicense(unittest.TestCase): - """ScoreLicense unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreLicense(self): - """Test ScoreLicense""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_license.ScoreLicense() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_likes_counts.py b/test/test_score_likes_counts.py deleted file mode 100644 index 623b7bf..0000000 --- a/test/test_score_likes_counts.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_likes_counts import ScoreLikesCounts # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreLikesCounts(unittest.TestCase): - """ScoreLikesCounts unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreLikesCounts(self): - """Test ScoreLikesCounts""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_likes_counts.ScoreLikesCounts() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_modification.py b/test/test_score_modification.py deleted file mode 100644 index c4f169b..0000000 --- a/test/test_score_modification.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_modification import ScoreModification # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreModification(unittest.TestCase): - """ScoreModification unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreModification(self): - """Test ScoreModification""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_modification.ScoreModification() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_privacy.py b/test/test_score_privacy.py deleted file mode 100644 index 781728d..0000000 --- a/test/test_score_privacy.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_privacy import ScorePrivacy # noqa: E501 -from flat_api.rest import ApiException - - -class TestScorePrivacy(unittest.TestCase): - """ScorePrivacy unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScorePrivacy(self): - """Test ScorePrivacy""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_privacy.ScorePrivacy() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_revision.py b/test/test_score_revision.py deleted file mode 100644 index c2017d1..0000000 --- a/test/test_score_revision.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_revision import ScoreRevision # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreRevision(unittest.TestCase): - """ScoreRevision unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreRevision(self): - """Test ScoreRevision""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_revision.ScoreRevision() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_revision_creation.py b/test/test_score_revision_creation.py deleted file mode 100644 index dc132fa..0000000 --- a/test/test_score_revision_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_revision_creation import ScoreRevisionCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreRevisionCreation(unittest.TestCase): - """ScoreRevisionCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreRevisionCreation(self): - """Test ScoreRevisionCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_revision_creation.ScoreRevisionCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_revision_statistics.py b/test/test_score_revision_statistics.py deleted file mode 100644 index 043b252..0000000 --- a/test/test_score_revision_statistics.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_revision_statistics import ScoreRevisionStatistics # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreRevisionStatistics(unittest.TestCase): - """ScoreRevisionStatistics unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreRevisionStatistics(self): - """Test ScoreRevisionStatistics""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_revision_statistics.ScoreRevisionStatistics() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_source.py b/test/test_score_source.py deleted file mode 100644 index ff55b65..0000000 --- a/test/test_score_source.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_source import ScoreSource # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreSource(unittest.TestCase): - """ScoreSource unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreSource(self): - """Test ScoreSource""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_source.ScoreSource() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_summary.py b/test/test_score_summary.py deleted file mode 100644 index b58de1b..0000000 --- a/test/test_score_summary.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_summary import ScoreSummary # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreSummary(unittest.TestCase): - """ScoreSummary unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreSummary(self): - """Test ScoreSummary""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_summary.ScoreSummary() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track.py b/test/test_score_track.py deleted file mode 100644 index ca1d77f..0000000 --- a/test/test_score_track.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track import ScoreTrack # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrack(unittest.TestCase): - """ScoreTrack unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrack(self): - """Test ScoreTrack""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track.ScoreTrack() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track_creation.py b/test/test_score_track_creation.py deleted file mode 100644 index b469a2d..0000000 --- a/test/test_score_track_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track_creation import ScoreTrackCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrackCreation(unittest.TestCase): - """ScoreTrackCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrackCreation(self): - """Test ScoreTrackCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track_creation.ScoreTrackCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track_point.py b/test/test_score_track_point.py deleted file mode 100644 index 49b006e..0000000 --- a/test/test_score_track_point.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track_point import ScoreTrackPoint # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrackPoint(unittest.TestCase): - """ScoreTrackPoint unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrackPoint(self): - """Test ScoreTrackPoint""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track_point.ScoreTrackPoint() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track_state.py b/test/test_score_track_state.py deleted file mode 100644 index 5ddbd68..0000000 --- a/test/test_score_track_state.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track_state import ScoreTrackState # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrackState(unittest.TestCase): - """ScoreTrackState unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrackState(self): - """Test ScoreTrackState""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track_state.ScoreTrackState() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track_type.py b/test/test_score_track_type.py deleted file mode 100644 index b160bbf..0000000 --- a/test/test_score_track_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track_type import ScoreTrackType # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrackType(unittest.TestCase): - """ScoreTrackType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrackType(self): - """Test ScoreTrackType""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track_type.ScoreTrackType() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_track_update.py b/test/test_score_track_update.py deleted file mode 100644 index f6f8757..0000000 --- a/test/test_score_track_update.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_track_update import ScoreTrackUpdate # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreTrackUpdate(unittest.TestCase): - """ScoreTrackUpdate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreTrackUpdate(self): - """Test ScoreTrackUpdate""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_track_update.ScoreTrackUpdate() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_score_views_counts.py b/test/test_score_views_counts.py deleted file mode 100644 index c810f92..0000000 --- a/test/test_score_views_counts.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.score_views_counts import ScoreViewsCounts # noqa: E501 -from flat_api.rest import ApiException - - -class TestScoreViewsCounts(unittest.TestCase): - """ScoreViewsCounts unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testScoreViewsCounts(self): - """Test ScoreViewsCounts""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.score_views_counts.ScoreViewsCounts() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_admin_update.py b/test/test_user_admin_update.py deleted file mode 100644 index a3fa75e..0000000 --- a/test/test_user_admin_update.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_admin_update import UserAdminUpdate # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserAdminUpdate(unittest.TestCase): - """UserAdminUpdate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserAdminUpdate(self): - """Test UserAdminUpdate""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_admin_update.UserAdminUpdate() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_api.py b/test/test_user_api.py deleted file mode 100644 index e70a643..0000000 --- a/test/test_user_api.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.api.user_api import UserApi # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserApi(unittest.TestCase): - """UserApi unit test stubs""" - - def setUp(self): - self.api = flat_api.api.user_api.UserApi() # noqa: E501 - - def tearDown(self): - pass - - def test_ger_user_likes(self): - """Test case for ger_user_likes - - List liked scores # noqa: E501 - """ - pass - - def test_get_user(self): - """Test case for get_user - - Get a public user profile # noqa: E501 - """ - pass - - def test_get_user_scores(self): - """Test case for get_user_scores - - List user's scores # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_basics.py b/test/test_user_basics.py deleted file mode 100644 index 50d8ba2..0000000 --- a/test/test_user_basics.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_basics import UserBasics # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserBasics(unittest.TestCase): - """UserBasics unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserBasics(self): - """Test UserBasics""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_basics.UserBasics() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_creation.py b/test/test_user_creation.py deleted file mode 100644 index 3b125c0..0000000 --- a/test/test_user_creation.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_creation import UserCreation # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserCreation(unittest.TestCase): - """UserCreation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserCreation(self): - """Test UserCreation""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_creation.UserCreation() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_details.py b/test/test_user_details.py deleted file mode 100644 index cb9ad12..0000000 --- a/test/test_user_details.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_details import UserDetails # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserDetails(unittest.TestCase): - """UserDetails unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserDetails(self): - """Test UserDetails""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_details.UserDetails() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_details_admin.py b/test/test_user_details_admin.py deleted file mode 100644 index a0b5408..0000000 --- a/test/test_user_details_admin.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_details_admin import UserDetailsAdmin # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserDetailsAdmin(unittest.TestCase): - """UserDetailsAdmin unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserDetailsAdmin(self): - """Test UserDetailsAdmin""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_details_admin.UserDetailsAdmin() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_details_admin_license.py b/test/test_user_details_admin_license.py deleted file mode 100644 index 868729e..0000000 --- a/test/test_user_details_admin_license.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_details_admin_license import UserDetailsAdminLicense # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserDetailsAdminLicense(unittest.TestCase): - """UserDetailsAdminLicense unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserDetailsAdminLicense(self): - """Test UserDetailsAdminLicense""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_details_admin_license.UserDetailsAdminLicense() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_instruments.py b/test/test_user_instruments.py deleted file mode 100644 index 67904c2..0000000 --- a/test/test_user_instruments.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_instruments import UserInstruments # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserInstruments(unittest.TestCase): - """UserInstruments unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserInstruments(self): - """Test UserInstruments""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_instruments.UserInstruments() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_public.py b/test/test_user_public.py deleted file mode 100644 index efefd15..0000000 --- a/test/test_user_public.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_public import UserPublic # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserPublic(unittest.TestCase): - """UserPublic unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserPublic(self): - """Test UserPublic""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_public.UserPublic() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_user_public_summary.py b/test/test_user_public_summary.py deleted file mode 100644 index 789fd01..0000000 --- a/test/test_user_public_summary.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding: utf-8 - -""" - Flat API - - 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. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and interoduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html) # noqa: E501 - - OpenAPI spec version: 2.6.0 - Contact: developers@flat.io - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - - -from __future__ import absolute_import - -import unittest - -import flat_api -from flat_api.models.user_public_summary import UserPublicSummary # noqa: E501 -from flat_api.rest import ApiException - - -class TestUserPublicSummary(unittest.TestCase): - """UserPublicSummary unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUserPublicSummary(self): - """Test UserPublicSummary""" - # FIXME: construct object with mandatory attributes with example values - # model = flat_api.models.user_public_summary.UserPublicSummary() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/tools/emit_inventory.py b/tools/emit_inventory.py new file mode 100755 index 0000000..6767e34 --- /dev/null +++ b/tools/emit_inventory.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +"""Emit OPERATIONS.json for the Python SDK (FR-001, FR-002). + +Language-neutral inventory the shared checker reads. Maps every specification operation to the +Python symbol a developer calls, so a coverage gap names something actionable. +""" + +from __future__ import annotations + +import json +import os +import re +import sys +from pathlib import Path + +import yaml + +ROOT = Path(__file__).resolve().parent.parent +# generate.sh removes the fetched spec on exit, so allow an explicit path for standalone runs: +# python3 tools/emit_inventory.py path/to/openapi.yaml +SPEC = Path( + sys.argv[1] if len(sys.argv) > 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 / "flat_api" / "api").glob("*.py"): + for match in re.finditer(r"^ def ([a-z0-9_]+)\(", path.read_text(), re.M): + symbols.setdefault(match.group(1), path.stem) + + models = set() + for path in (ROOT / "flat_api" / "models").glob("*.py"): + models |= set(re.findall(r"^class (\w+)\(", path.read_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 = snake(oid) + 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": "python", "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..ad67088 --- /dev/null +++ b/tools/generate.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +# Regenerate the Flat Python 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 into the repository, applies post-generation +# patches, emits the inventory and bumps the version. +# +# Generating into a scratch tree and copying selectively makes FR-025d structural: the generator +# physically cannot write outside the declared zone, so a protected README or pyproject can never be +# clobbered by a generator that changes its output layout. +# +# SPEC_REF api-reference release tag to read (default: latest release) +# SPEC_LOCAL_FILE use this local spec instead of fetching +# BUMP patch | minor | major | none (default: patch) +# +# The generator emits sync OR async, never both (T001 spike), so this runs it twice and merges. +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 + +# Read the current version before anything is wiped. The exports patch rewrites __init__.py with a +# placeholder, so reading it afterwards would reset the version on every run. +# VERSION is the durable source of truth: it is hand-maintained, outside the generated zone, and +# unambiguous. __init__.py is derived from it, so reading that instead would be circular. +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 must live inside the repository: the docker backend mounts the repo root at /local, +# so a path outside it would be written into the repo as ./var/folders/... +SCRATCH=".sdkgen-scratch" +rm -rf "$SCRATCH" +trap 'rm -rf "$SCRATCH"; cleanup_spec' EXIT + +log "Pass 1/2: synchronous client (urllib3)" +run_generator "python" "tools/openapi-config.json" "$SCRATCH/sync" + +log "Pass 2/2: asynchronous client (asyncio)" +run_generator "python" "tools/openapi-config-async.json" "$SCRATCH/async" + +log "Wiping the generated zone" +zone_wipe + +log "Installing the generated zone" +mkdir -p flat_api docs/reference .openapi-generator +cp -R "$SCRATCH/sync/flat_api/." flat_api/ +rm -rf flat_api/docs flat_api/test +# source-only mode emits per-operation docs under the package; they belong in the generated +# reference directory, not beside the hand-written README (FR-025c). +if [ -d "$SCRATCH/sync/flat_api/docs" ]; then cp -R "$SCRATCH/sync/flat_api/docs/." docs/reference/; fi +[ -d "$SCRATCH/sync/.openapi-generator" ] && cp -R "$SCRATCH/sync/.openapi-generator/." .openapi-generator/ +# The async pass contributes its api/ and api_client under flat_api/aio (merged by patches). +mkdir -p flat_api/aio +cp -R "$SCRATCH/async/flat_api_async/." flat_api/aio/ +rm -rf flat_api/aio/docs flat_api/aio/test + +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" +python3 - "$NEW_VERSION" <<'PY' +import pathlib, re, sys +v = sys.argv[1] +p = pathlib.Path("flat_api/__init__.py") +t = p.read_text() +if re.search(r'__version__ = "[0-9]+\.[0-9]+\.[0-9]+"', t): + t = re.sub(r'__version__ = "[0-9]+\.[0-9]+\.[0-9]+"', f'__version__ = "{v}"', t) +else: + t += f'\n__version__ = "{v}"\n' +p.write_text(t) +PY + +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-async.json b/tools/openapi-config-async.json new file mode 100644 index 0000000..9b07048 --- /dev/null +++ b/tools/openapi-config-async.json @@ -0,0 +1,9 @@ +{ + "packageName": "flat_api_async", + "packageVersion": "2.0.0", + "projectName": "flat-api", + "library": "asyncio", + "generateSourceCodeOnly": true, + "hideGenerationTimestamp": true, + "disallowAdditionalPropertiesIfNotPresent": false +} diff --git a/tools/openapi-config.json b/tools/openapi-config.json new file mode 100644 index 0000000..4f05567 --- /dev/null +++ b/tools/openapi-config.json @@ -0,0 +1,9 @@ +{ + "packageName": "flat_api", + "packageVersion": "2.0.0", + "projectName": "flat-api", + "library": "urllib3", + "generateSourceCodeOnly": true, + "hideGenerationTimestamp": true, + "disallowAdditionalPropertiesIfNotPresent": false +} diff --git a/tools/patches/10_async_merge.py b/tools/patches/10_async_merge.py new file mode 100644 index 0000000..43f59d2 --- /dev/null +++ b/tools/patches/10_async_merge.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Merge the async generation pass into the package as `flat_api.aio` (FR-005). + +The generator emits sync or async but never both (T001 spike), so the async pass is generated as a +separate package and copied to `flat_api/aio`. Its internal absolute imports still reference the +standalone package name and must be rewritten to the subpackage path. + +Idempotent: rewriting an already-rewritten import is a no-op. +""" + +from __future__ import annotations + +import pathlib +import re +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +AIO = ROOT / "flat_api" / "aio" + +if not AIO.is_dir(): + sys.exit("10_async_merge: flat_api/aio missing; the async generation pass did not run") + +PATTERNS = ( + (re.compile(r"\bfrom flat_api_async\b"), "from flat_api.aio"), + (re.compile(r"\bimport flat_api_async\b"), "import flat_api.aio"), + (re.compile(r"\bflat_api_async\."), "flat_api.aio."), +) + +changed = 0 +for path in AIO.rglob("*.py"): + original = path.read_text() + text = original + for pattern, replacement in PATTERNS: + text = pattern.sub(replacement, text) + if text != original: + path.write_text(text) + changed += 1 + +if list(AIO.rglob("*.py")) and "flat_api_async" in (AIO / "__init__.py").read_text(): + sys.exit("10_async_merge: rewrite incomplete, flat_api_async still referenced (FR-025)") + +print(f" async merge: rewrote imports in {changed} file(s)") diff --git a/tools/patches/20_errors.py b/tools/patches/20_errors.py new file mode 100644 index 0000000..91d8fdb --- /dev/null +++ b/tools/patches/20_errors.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Typed error hierarchy keyed on the API's `code` field (FR-006d, FR-006h). + +Flat returns {"code", "message", "id"}. Two things make a naive mapping wrong: + + * rate limiting returns 403, not 429, so it shares a status with genuine authorization failures. + Only the body's `code` separates them. + * `id` is documented as present only for internal and backend errors, so it cannot be promised + on every error. + +Idempotent: writes a fixed file. +""" + +from __future__ import annotations + +import pathlib +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +TARGET = ROOT / "flat_api" / "errors.py" + +TARGET.write_text('''"""Typed errors for the Flat API. + +Branch on the error class, not on the status code: rate limiting and authorization failures both +return HTTP 403 and are separated only by the response body's ``code``. +""" + +from __future__ import annotations + +from typing import Any, Mapping + +__all__ = [ + "FlatError", + "FlatAuthenticationError", + "FlatAuthorizationError", + "FlatRateLimitError", + "FlatValidationError", + "FlatNotFoundError", + "FlatQuotaError", + "FlatServerError", + "from_response", +] + +RATE_LIMIT_CODE = "API_RATE_LIMIT_EXCEEDED" +QUOTA_CODES = frozenset({"QUOTA_EXCEEDED", "CREDITS_EXHAUSTED", "OMR_CREDITS_EXHAUSTED"}) + + +class FlatError(Exception): + """Base class for every error raised by this SDK.""" + + def __init__( + self, + message: str, + *, + status: int | None = None, + code: str | None = None, + request_id: str | None = None, + headers: Mapping[str, str] | None = None, + body: Any = None, + ) -> None: + super().__init__(message) + self.message = message + self.status = status + self.code = code + #: The server-provided error identifier. Present only for internal and backend errors, + #: so treat it as optional and quote it to support when you have it. + self.request_id = request_id + self.headers = dict(headers or {}) + self.body = body + + def __str__(self) -> str: + parts = [self.message] + if self.code: + parts.append(f"code={self.code}") + if self.status is not None: + parts.append(f"status={self.status}") + if self.request_id: + parts.append(f"id={self.request_id}") + return " ".join(parts) + + +class FlatAuthenticationError(FlatError): + """The token is missing, invalid or expired, or a refresh failed. Re-authorize.""" + + +class FlatAuthorizationError(FlatError): + """Authenticated but not permitted: a missing scope or insufficient permission.""" + + +class FlatRateLimitError(FlatError): + """The account or IP exceeded its request quota. Returned as HTTP 403, not 429.""" + + def __init__(self, message: str, **kwargs: Any) -> None: + super().__init__(message, **kwargs) + self.limit = _int_header(self.headers, "X-RateLimit-Limit") + self.remaining = _int_header(self.headers, "X-RateLimit-Remaining") + #: UTC epoch seconds at which the window resets. Flat sends no Retry-After header. + self.reset = _int_header(self.headers, "X-RateLimit-Reset") + + +class FlatValidationError(FlatError): + """The request body or parameters failed validation.""" + + +class FlatNotFoundError(FlatError): + """The resource does not exist, or is not visible to this token.""" + + +class FlatQuotaError(FlatError): + """A metered resource, such as OMR credits, is exhausted.""" + + +class FlatServerError(FlatError): + """An internal or backend error. ``request_id`` is normally set here.""" + + +def _int_header(headers: Mapping[str, str], name: str) -> int | None: + for key, value in headers.items(): + if key.lower() == name.lower(): + try: + return int(value) + except (TypeError, ValueError): + return None + return None + + +def from_response( + status: int, + body: Any, + headers: Mapping[str, str] | None = None, +) -> FlatError: + """Build the right error for a non-2xx response.""" + payload = body if isinstance(body, dict) else {} + code = payload.get("code") + message = payload.get("message") or f"HTTP {status}" + common = { + "status": status, + "code": code, + "request_id": payload.get("id"), + "headers": headers, + "body": body, + } + + if status == 403 and code == RATE_LIMIT_CODE: + return FlatRateLimitError(message, **common) + if code in QUOTA_CODES: + return FlatQuotaError(message, **common) + if status == 401: + return FlatAuthenticationError(message, **common) + if status == 403: + return FlatAuthorizationError(message, **common) + if status == 404: + return FlatNotFoundError(message, **common) + if status in (400, 422): + return FlatValidationError(message, **common) + if status >= 500: + return FlatServerError(message, **common) + return FlatError(message, **common) +''') + +# Writing errors.py is not enough: nothing raises those classes unless the request path is taught +# to. The generated client raises its own ApiException subclasses, so a caller who follows the +# README and catches FlatNotFoundError catches nothing. Rewire the one raise site. +CLIENT = ROOT / "flat_api" / "api_client.py" +client_text = CLIENT.read_text() + +raise_site = """ raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + )""" +flat_raise = """ raise _flat_error_from_response( + status=response_data.status, + body=return_data if isinstance(return_data, dict) else response_text, + headers=dict(response_data.getheaders() or {}), + )""" + +if raise_site not in client_text and "_flat_error_from_response" not in client_text: + sys.exit("20_errors: could not find the raise site in api_client.py (FR-025)") + +if raise_site in client_text: + client_text = client_text.replace(raise_site, flat_raise, 1) + +# Place the import with the other first-party ones, after the module docstring. Prepending it +# would displace the docstring and leave a stray string expression at the top of the file. +import_line = "from flat_api.errors import from_response as _flat_error_from_response\n" +if import_line not in client_text: + anchor = "from flat_api.configuration import Configuration\n" + if anchor not in client_text: + sys.exit("20_errors: could not place the import in api_client.py (FR-025)") + client_text = client_text.replace(anchor, import_line + anchor, 1) + +CLIENT.write_text(client_text) + +print(" errors: wrote flat_api/errors.py and raised them from api_client.py") diff --git a/tools/patches/30_retry.py b/tools/patches/30_retry.py new file mode 100644 index 0000000..d745ed2 --- /dev/null +++ b/tools/patches/30_retry.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Retry policy (FR-006e). Idempotent: writes a fixed file.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +(ROOT / "flat_api" / "_retry.py").write_text('''"""Retry policy for the Flat API. + +Flat does not follow the usual conventions, and getting this wrong is silent: + + * rate limiting returns **403**, not 429 + * there is **no Retry-After header**; the reset time is ``X-RateLimit-Reset``, UTC epoch seconds + * a plain 403 is a genuine authorization failure and must never be retried + +So the policy keys on the response body's ``code``, not on the status alone. +""" + +from __future__ import annotations + +import random +import time +from dataclasses import dataclass + +from flat_api.errors import FlatError, FlatRateLimitError, FlatServerError + +#: Methods safe to replay. A non-idempotent request that may already have been applied is not. +IDEMPOTENT_METHODS = frozenset({"GET", "HEAD", "OPTIONS", "PUT", "DELETE"}) + +MAX_RATE_LIMIT_WAIT = 300.0 + + +@dataclass(frozen=True) +class RetryPolicy: + """How the client retries. Pass ``RetryPolicy.disabled()`` to opt out entirely.""" + + attempts: int = 3 + backoff_base: float = 0.5 + backoff_max: float = 30.0 + jitter: float = 0.25 + respect_rate_limit_reset: bool = True + + @classmethod + def disabled(cls) -> "RetryPolicy": + """No retries. Errors still arrive typed, and a rate-limit error still carries its reset.""" + return cls(attempts=1) + + @property + def enabled(self) -> bool: + return self.attempts > 1 + + def should_retry(self, error: BaseException, method: str, attempt: int) -> bool: + if attempt >= self.attempts: + return False + if method.upper() not in IDEMPOTENT_METHODS: + return False + if isinstance(error, FlatRateLimitError): + return True + if isinstance(error, FlatServerError): + return True + # A transport failure before the request was sent is safe to replay. + return isinstance(error, OSError) and not isinstance(error, FlatError) + + def delay_for(self, error: BaseException, attempt: int) -> float: + if ( + self.respect_rate_limit_reset + and isinstance(error, FlatRateLimitError) + and error.reset is not None + ): + wait = error.reset - time.time() + if wait > 0: + return min(wait + random.uniform(0, self.jitter), MAX_RATE_LIMIT_WAIT) + exponential = min(self.backoff_base * (2 ** (attempt - 1)), self.backoff_max) + return exponential + random.uniform(0, self.jitter * exponential) +''') +print(" retry: wrote flat_api/_retry.py") diff --git a/tools/patches/40_pagination.py b/tools/patches/40_pagination.py new file mode 100644 index 0000000..f914d17 --- /dev/null +++ b/tools/patches/40_pagination.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""Auto-pagination (FR-006f). Idempotent: writes a fixed file.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +(ROOT / "flat_api" / "pagination.py").write_text('''"""Cursor pagination for the Flat API. + +Eight operations at v2.25.0 are cursor-paginated, identified by a ``next`` query parameter. Note the +parameter is a shared component (``#/components/parameters/next``): any tool that reads an +operation\\'s parameters without resolving ``$ref`` under-counts them and ships collections that +silently truncate. + +The cursor itself is **not in the response body**. It arrives in the ``Link`` header, which the +specification does not declare, so it is parsed at runtime from the generated ``ApiResponse``. +""" + +from __future__ import annotations + +import re +from collections.abc import Callable, Iterator +from typing import Any, TypeVar + +__all__ = ["parse_link_header", "paginate"] + +T = TypeVar("T") + +_LINK = re.compile(r'<(?P[^>]+)>\\s*;\\s*rel="(?P[^"]+)"') +_NEXT_PARAM = re.compile(r"[?&]next=(?P[^&]+)") + + +def parse_link_header(value: str | None) -> dict[str, str]: + """Parse an RFC 5988 Link header into {rel: url}.""" + if not value: + return {} + return {m.group("rel"): m.group("url") for m in _LINK.finditer(value)} + + +def next_cursor(headers: dict[str, str] | None) -> str | None: + """Extract the opaque ``next`` cursor from a response\\'s Link header, if any.""" + if not headers: + return None + link = next((v for k, v in headers.items() if k.lower() == "link"), None) + url = parse_link_header(link).get("next") + if not url: + return None + match = _NEXT_PARAM.search(url) + return match.group("cursor") if match else None + + +def paginate( + fetch_page: Callable[..., Any], + *args: Any, + **kwargs: Any, +) -> Iterator[T]: + """Yield every item across all pages of a cursor-paginated operation. + + ``fetch_page`` must be the generated ``*_with_http_info`` variant, which returns an + ``ApiResponse`` carrying the headers the cursor lives in. + + 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. + """ + cursor: str | None = kwargs.pop("next", None) + seen: set[str] = set() + + while True: + response = fetch_page(*args, **({**kwargs, "next": cursor} if cursor else kwargs)) + page = getattr(response, "data", response) + if page: + yield from page + + cursor = next_cursor(getattr(response, "headers", None)) + if not cursor: + return + # A server that returns a cursor it already gave us would loop forever. + if cursor in seen: + return + seen.add(cursor) +''') +print(" pagination: wrote flat_api/pagination.py") diff --git a/tools/patches/50_oauth.py b/tools/patches/50_oauth.py new file mode 100644 index 0000000..08bd440 --- /dev/null +++ b/tools/patches/50_oauth.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +"""OAuth2 helpers and single-flight refresh (FR-006i to FR-006l). Idempotent.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +(ROOT / "flat_api" / "oauth.py").write_text('''"""OAuth2 support for the Flat API. + +The public specification declares one security scheme: OAuth2 with the authorization-code flow and +23 scopes. A Personal Access Token is an OAuth access token for your own account, so passing a token +straight to the client covers both cases. + +A refresh token is only issued when the authorization request sets ``access_type=offline``. + +This module never stores a token. Persistence is deployment-specific, so the client hands refreshed +tokens to a callback you supply and it is your job to save them. +""" + +from __future__ import annotations + +import threading +import time +from dataclasses import dataclass, field +from urllib.parse import urlencode + +import httpx + +from flat_api.errors import FlatAuthenticationError + +__all__ = ["Tokens", "OAuth2Helper", "TokenManager"] + +AUTHORIZE_URL = "https://flat.io/auth/oauth" +TOKEN_URL = "https://api.flat.io/oauth/access_token" + +#: Refresh this many seconds before nominal expiry, to avoid racing the server clock. +EXPIRY_SKEW = 30.0 + + +@dataclass +class Tokens: + access_token: str + refresh_token: str | None = None + expires_at: float | None = None + + @classmethod + def from_response(cls, payload: dict) -> "Tokens": + expires_in = payload.get("expires_in") + return cls( + access_token=payload["access_token"], + refresh_token=payload.get("refresh_token"), + expires_at=time.time() + float(expires_in) if expires_in else None, + ) + + @property + def expired(self) -> bool: + return self.expires_at is not None and time.time() >= self.expires_at - EXPIRY_SKEW + + +class OAuth2Helper: + """Builds the authorization URL and exchanges codes for tokens.""" + + def __init__(self, client_id: str, client_secret: str, redirect_uri: str) -> None: + self.client_id = client_id + self.client_secret = client_secret + self.redirect_uri = redirect_uri + + def authorize_url( + self, + scopes: list[str], + state: str, + *, + offline: bool = True, + ) -> str: + """URL to send a user to. ``offline=True`` is what yields a refresh token.""" + params = { + "client_id": self.client_id, + "redirect_uri": self.redirect_uri, + "response_type": "code", + "scope": " ".join(scopes), + "state": state, + } + if offline: + params["access_type"] = "offline" + return f"{AUTHORIZE_URL}?{urlencode(params)}" + + def exchange_code(self, code: str) -> Tokens: + return self._token_request( + {"grant_type": "authorization_code", "code": code, "redirect_uri": self.redirect_uri} + ) + + def refresh(self, refresh_token: str) -> Tokens: + return self._token_request( + {"grant_type": "refresh_token", "refresh_token": refresh_token} + ) + + def _token_request(self, payload: dict) -> Tokens: + body = {**payload, "client_id": self.client_id, "client_secret": self.client_secret} + response = httpx.post(TOKEN_URL, data=body, timeout=30) + if response.status_code >= 400: + raise FlatAuthenticationError( + "OAuth2 token request failed; the user must re-authorize", + status=response.status_code, + body=_safe_json(response), + ) + return Tokens.from_response(response.json()) + + +class TokenManager: + """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. + """ + + def __init__( + self, + tokens: Tokens, + helper: OAuth2Helper | None = None, + on_token_refresh=None, + ) -> None: + self._tokens = tokens + self._helper = helper + self._on_refresh = on_token_refresh + self._lock = threading.Lock() + + @property + def access_token(self) -> str: + return self._tokens.access_token + + def refresh(self) -> str: + """Refresh once, even under concurrency, and return the new access token.""" + with self._lock: + current = self._tokens.access_token + if self._tokens.access_token != current: + return self._tokens.access_token + if self._helper is None or not self._tokens.refresh_token: + raise FlatAuthenticationError( + "the access token expired and no refresh token is available; " + "the user must re-authorize" + ) + self._tokens = self._helper.refresh(self._tokens.refresh_token) + if self._on_refresh is not None: + self._on_refresh(self._tokens) + return self._tokens.access_token + + +def _safe_json(response: httpx.Response): + try: + return response.json() + except ValueError: + return None +''') +print(" oauth: wrote flat_api/oauth.py") diff --git a/tools/patches/60_client.py b/tools/patches/60_client.py new file mode 100644 index 0000000..56a1f43 --- /dev/null +++ b/tools/patches/60_client.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""Ergonomic client with timeouts, base URL, retry and auth (FR-006g, FR-006i). Idempotent.""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +(ROOT / "flat_api" / "client.py").write_text('''"""The entry points a developer actually uses. + +``FlatClient`` is synchronous, ``AsyncFlatClient`` is its asynchronous twin. Both take the same +arguments and raise the same typed errors; only the call convention differs. +""" + +from __future__ import annotations + +from typing import Any + +from flat_api.api_client import ApiClient +from flat_api.configuration import Configuration +from flat_api.oauth import OAuth2Helper, TokenManager, Tokens +from flat_api._retry import RetryPolicy + +__all__ = ["FlatClient", "AsyncFlatClient"] + +DEFAULT_BASE_URL = "https://api.flat.io/v2" +#: A finite default. Waiting forever is not an acceptable default for an SDK. +DEFAULT_TIMEOUT = 30.0 + + +class _BaseClient: + def __init__( + self, + access_token: str | None = None, + *, + tokens: Tokens | None = None, + oauth: OAuth2Helper | None = None, + on_token_refresh: Any = None, + base_url: str = DEFAULT_BASE_URL, + timeout: float = DEFAULT_TIMEOUT, + retry: RetryPolicy | None = None, + ) -> None: + if access_token is None and tokens is None: + raise ValueError("pass either access_token= or tokens=") + if tokens is None: + tokens = Tokens(access_token=access_token or "") + + self.tokens = TokenManager(tokens, helper=oauth, on_token_refresh=on_token_refresh) + self.retry = retry if retry is not None else RetryPolicy() + self.base_url = base_url + self.timeout = timeout + + configuration = Configuration(host=base_url) + configuration.access_token = self.tokens.access_token + self._configuration = configuration + self._api_client = self._build_api_client(configuration) + + def _build_api_client(self, configuration: Configuration) -> Any: + return ApiClient(configuration) + + @property + def api_client(self) -> Any: + """The generated client, for operations not yet surfaced ergonomically.""" + return self._api_client + + def _reauthenticate(self) -> None: + """Refresh the access token and push it into the generated configuration.""" + token = self.tokens.refresh() + self._configuration.access_token = token + + +class FlatClient(_BaseClient): + """Synchronous Flat API client. + + client = FlatClient(access_token="...") + me = client.api_client # generated APIs hang off here + """ + + +class AsyncFlatClient(_BaseClient): + """Asynchronous Flat API client, backed by the ``flat_api.aio`` generation pass.""" + + def _build_api_client(self, configuration: Configuration) -> Any: + from flat_api.aio.api_client import ApiClient as AsyncApiClient + + return AsyncApiClient(configuration) +''') +print(" client: wrote flat_api/client.py") diff --git a/tools/patches/70_docs.py b/tools/patches/70_docs.py new file mode 100644 index 0000000..0cf8eed --- /dev/null +++ b/tools/patches/70_docs.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Verify the generated code actually 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 Python itself and +fails loudly if operation docstrings are 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 ast +import pathlib +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +API_DIR = ROOT / "flat_api" / "api" + +#: Below this, the generator has stopped propagating descriptions and the config is wrong. +THRESHOLD = 0.95 + + +def main() -> int: + if not API_DIR.is_dir(): + print(" docs: no generated api/ directory", file=sys.stderr) + return 1 + + total = documented = 0 + undocumented: list[str] = [] + + for path in sorted(API_DIR.glob("*.py")): + tree = ast.parse(path.read_text()) + for node in ast.walk(tree): + if not isinstance(node, ast.FunctionDef) or node.name.startswith("_"): + continue + # The generator emits three variants per operation; check the plain one. + if node.name.endswith(("_with_http_info", "_without_preload_content")): + continue + total += 1 + doc = ast.get_docstring(node) + if doc and len(doc.strip()) > 20: + documented += 1 + else: + undocumented.append(f"{path.stem}.{node.name}") + + 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..d40bbe0 --- /dev/null +++ b/tools/patches/80_user_agent.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Flat-branded User-Agent that tracks the package version (FR-013 traceability). + +The generator emits `OpenAPI-Generator//python`, which identifies neither Flat nor this +client: in the API logs it is indistinguishable from any other generated client. Worse, the version +is baked in from generator config, so it drifts from the real package version. + +This derives it from `__version__`, so it cannot go stale. The previous generation hard-coded +`flat_api/1.1.0` in generator config and was still claiming 1.1.0 years later. + +Idempotent: rewrites to a fixed expression. +""" + +from __future__ import annotations + +import pathlib +import re +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +TARGET = ROOT / "flat_api" / "api_client.py" + +text = TARGET.read_text() + +# The generated literal, or our own expression from a previous run. +pattern = re.compile(r"self\.user_agent = (?:'[^']*'|f'[^']*'|_flat_user_agent\(\))") +replacement = "self.user_agent = _flat_user_agent()" + +if not pattern.search(text): + sys.exit("80_user_agent: could not find the user_agent assignment (FR-025)") + +text = pattern.sub(replacement, text, count=1) + +helper = ''' + +def _flat_user_agent() -> str: + """`Flat-SDK-Python/ (python/)`. + + Derived from the package version so it can never drift from what is published. + """ + import platform + + from flat_api import __version__ + + return ( + f"Flat-SDK-Python/{__version__} (python/{platform.python_version()})" + ) +''' + +# Append the helper only if it is not already present anywhere. Checking only the text before the +# assignment would always be true (the helper lives after it) and append a fresh copy every run. +if "def _flat_user_agent" not in text: + text = text.rstrip() + "\n" + helper + +TARGET.write_text(text) +print(" user-agent: Flat-SDK-Python/") diff --git a/tools/patches/90_exports.py b/tools/patches/90_exports.py new file mode 100644 index 0000000..ea3e01c --- /dev/null +++ b/tools/patches/90_exports.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Public package surface (FR-004, FR-006b). Idempotent: writes a fixed file. + +Runs last so it can re-export everything the earlier patches added. ``__version__`` is read from the +durable VERSION file rather than written as a placeholder: a placeholder would make this patch +non-idempotent, because re-applying it would reset a version generate.sh had already written. +""" + +from __future__ import annotations + +import pathlib + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +INIT = ROOT / "flat_api" / "__init__.py" +VERSION_FILE = ROOT / "VERSION" +version = VERSION_FILE.read_text().strip() if VERSION_FILE.is_file() else "0.0.0" + +# Keep the generator's model and API re-exports; prepend the ergonomic surface. +generated = INIT.read_text() if INIT.is_file() else "" +marker = "# --- flat_api ergonomic surface (tools/patches/90_exports.py) ---" +if marker in generated: + generated = generated.split(marker, 1)[1].split("# --- end ---", 1)[-1] +# The preserved tail already starts with a newline; the template supplies its own, so without this +# a blank line accumulates on every run and the patch is not idempotent (FR-025). +generated = generated.lstrip("\n") + +INIT.write_text( + f'''"""Flat API client. + + from flat_api import FlatClient + client = FlatClient(access_token="...") + +Async: + + from flat_api import AsyncFlatClient + client = AsyncFlatClient(access_token="...") +""" + +{marker} +__version__ = "{version}" + +from flat_api.client import AsyncFlatClient, FlatClient +from flat_api.errors import ( + FlatAuthenticationError, + FlatAuthorizationError, + FlatError, + FlatNotFoundError, + FlatQuotaError, + FlatRateLimitError, + FlatServerError, + FlatValidationError, +) +from flat_api.oauth import OAuth2Helper, Tokens +from flat_api.pagination import paginate +from flat_api._retry import RetryPolicy + +__all__ = [ + "AsyncFlatClient", + "FlatClient", + "FlatAuthenticationError", + "FlatAuthorizationError", + "FlatError", + "FlatNotFoundError", + "FlatQuotaError", + "FlatRateLimitError", + "FlatServerError", + "FlatValidationError", + "OAuth2Helper", + "RetryPolicy", + "Tokens", + "paginate", + "__version__", +] +# --- end --- +{generated}''' +) +print(" exports: rewrote flat_api/__init__.py") diff --git a/tools/patches/95_py_typed.py b/tools/patches/95_py_typed.py new file mode 100755 index 0000000..df1f625 --- /dev/null +++ b/tools/patches/95_py_typed.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +"""PEP 561 marker, so consumers actually get the type information (FR-025). + +Every model in this client is a fully annotated pydantic class, but without `py.typed` a type +checker in a consumer project treats the whole package as untyped and silently ignores all of it. +The marker has to be recreated here because `flat_api/` is the generated zone: the wipe at the top +of every run removes it, and the generator does not emit one in source-only mode. + +Idempotent: writes a zero-byte file that is identical on every run. +""" + +from __future__ import annotations + +import pathlib +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent.parent +PACKAGE = ROOT / "flat_api" + +if not PACKAGE.is_dir(): + sys.exit("95_py_typed: flat_api/ is missing, the generated zone was not installed (FR-025)") + +(PACKAGE / "py.typed").write_bytes(b"") +print(" py.typed: PEP 561 marker written") diff --git a/tools/smoke.py b/tools/smoke.py new file mode 100644 index 0000000..e4cd1e1 --- /dev/null +++ b/tools/smoke.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +"""Python smoke entrypoint (FR-016). + +Drives the shared scenarios in api-client-gen/smoke/scenarios.yaml against production. Score +lifecycle only: no OMR conversion, nothing metered (FR-016a). + +Any account can run this, so a contributor can point it at their own. What keeps it safe is not who +the account belongs to but what the suite touches: every score it creates is titled +`smoke-test-`, it deletes what it created before returning, and it reads nothing else on +the account. + +Never prints a response body, token or account identifier (FR-016d). +""" + +from __future__ import annotations + +import base64 +import os +import sys +import uuid +from pathlib import Path +from typing import Any + +import yaml + +sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) + +from flat_api import ( # noqa: E402 + FlatAuthenticationError, + FlatClient, + FlatNotFoundError, +) +from flat_api.api.account_api import AccountApi # noqa: E402 +from flat_api.api.collection_api import CollectionApi # noqa: E402 +from flat_api.api.score_api import ScoreApi # noqa: E402 +from flat_api.models.score_creation import ScoreCreation # noqa: E402 +from flat_api.models.score_creation_file_import import ScoreCreationFileImport # noqa: E402 + +TITLE_PREFIX = "smoke-test" + + +def redact(text: str) -> str: + """Output redaction is not optional: a failing run must not become a data disclosure.""" + return "" if os.environ.get("FLAT_SMOKE_REDACT") == "1" else text + + +def main() -> int: + scenarios_path = Path(sys.argv[1] if len(sys.argv) > 1 else "scenarios.yaml") + scenarios = yaml.safe_load(scenarios_path.read_text()) + + forbidden = set(scenarios.get("forbidden_operations", [])) + for scenario in scenarios["scenarios"]: + if scenario.get("operation") in forbidden: + print(f"refusing to run {scenario['id']}: {scenario['operation']} is metered") + return 2 + + token = os.environ.get("FLAT_TEST_TOKEN") + if not token: + print("FLAT_TEST_TOKEN is required", file=sys.stderr) + return 2 + + fixture = scenarios_path.parent / "fixtures" / "minimal.musicxml" + if not fixture.is_file(): + print(f"missing fixture: {fixture}", file=sys.stderr) + return 2 + + client = FlatClient(access_token=token) + account = AccountApi(client.api_client) + scores = ScoreApi(client.api_client) + collections = CollectionApi(client.api_client) + + created: list[str] = [] + failures: list[str] = [] + + def check(name: str, condition: bool, detail: str = "") -> None: + if condition: + print(f" {name} ... ok") + else: + print(f" {name} ... FAIL") + failures.append(f"{name}: {detail}" if detail else name) + + try: + # The token authenticates and identifies an account. + me: Any = account.get_authenticated_user() + check("whoami", bool(getattr(me, "id", None)), "no id on the authenticated user") + + # Create a score from MusicXML, the most common write path. + title = f"{TITLE_PREFIX}-{uuid.uuid4().hex[:8]}" + # createScore takes the ScoreCreation union, not a variant directly: the file import is one + # of three ways to create a score, alongside the builder and a Drive import. + score: Any = scores.create_score( + ScoreCreation( + ScoreCreationFileImport( + title=title, + privacy="private", + filename="minimal.musicxml", + # The only encoding the API declares. Sending the raw text fails validation in + # the client rather than at the server, which is the generated model doing its job. + data=base64.b64encode(fixture.read_bytes()).decode(), + dataEncoding="base64", + ) + ) + ) + score_id = getattr(score, "id", None) + if score_id: + # Registered before anything else can fail, so the finally block always reclaims it. + created.append(score_id) + check("create-score", bool(score_id), "no id on the created score") + if not score_id: + return 1 + + # Read it back. + fetched: Any = scores.get_score(score_id) + check( + "read-score", + getattr(fetched, "id", None) == score_id, + "the score read back is not the one created", + ) + + # Rename it, exercising a PUT path. + renamed = f"{title}-renamed" + updated: Any = scores.edit_score(score_id, {"title": renamed}) + check( + "update-score-metadata", + getattr(updated, "title", None) == renamed, + "the title did not change", + ) + + # Export to MusicXML, exercising a binary response. + exported = scores.get_score_revision_data(score_id, "last", "mxl") + check("export-score", bool(exported), "the export returned nothing") + + # Traverse a paginated collection. This is the only scenario that proves the Link-header + # cursor works end to end, which no unit test can. + # + # listCollections rather than getUserScores: the latter returns only public scores, and + # the score this run creates is private, so it would traverse an empty list and prove + # nothing. Every account has at least its own collections. + page: Any = collections.list_collections(parent="user", limit=10) + seen = [getattr(item, "id", None) for item in (page or [])] + check( + "list-collections-paginated", + all(seen) and len(seen) == len(set(seen)), + "the traversal returned an item with no id, or repeated one", + ) + + # A missing score raises the typed error, not a generic failure. This is what makes the + # SDK usable under failure rather than merely correct under success. + try: + scores.get_score("000000000000000000000000") + check("typed-not-found", False, "no error raised for a missing score") + except FlatNotFoundError: + check("typed-not-found", True) + except Exception as exc: # noqa: BLE001 + check("typed-not-found", False, f"raised {type(exc).__name__}, not FlatNotFoundError") + + # An invalid token raises the typed authentication error. + try: + AccountApi(FlatClient(access_token="invalid").api_client).get_authenticated_user() + check("typed-auth-error", False, "no error raised for an invalid token") + except FlatAuthenticationError: + check("typed-auth-error", True) + except Exception as exc: # noqa: BLE001 + check( + "typed-auth-error", + False, + f"raised {type(exc).__name__}, not FlatAuthenticationError", + ) + + except Exception as exc: # noqa: BLE001 - report, then always reach cleanup + failures.append(f"unhandled {type(exc).__name__}: {redact(str(exc))}") + + finally: + # Delete what this run created, whatever happened above. Residue that survives is reported + # rather than swallowed, so cleanup.py can reclaim it and a maintainer knows to look. + for score_id in created: + try: + scores.delete_score(score_id) + print(f" cleanup {redact(score_id)} ... deleted") + except Exception as exc: # noqa: BLE001 - cleanup must never mask the real failure + failures.append(f"cleanup failed for {redact(score_id)}: {type(exc).__name__}") + + if failures: + for failure in failures: + print(f" FAIL {failure}", file=sys.stderr) + return 1 + + print("smoke: PASS") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 3d0be61..0000000 --- a/tox.ini +++ /dev/null @@ -1,10 +0,0 @@ -[tox] -envlist = py27, py3 - -[testenv] -deps=-r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -commands= - nosetests \ - []